Re:Why you should learn just a little Awk - A Tutorial by Ex...
by a3_nm on Sunday August 28, 2011 @05:30PM
(#2935036)
The interested reader should not assume hastily, however, that tr -s is enough to make cut behave exactly like awk. Hint: leading spaces.
pi:~$ echo ' foo' | tr -s ' ' | cut -d ' ' -f 1
pi:~$ echo ' foo' | awk '{print $1}'
foo
Of course, the awk solution is more succint and elegant in this case - I just think that tr -s / cut -d is handy to know from time to time, too.