On Mon, 26 Jul 2004 07:47:23 -0500 (CDT), Adam Maloney <adam at whee.org> wrote:
> Yeah!  Awk rules!

It is quite useful.  A common use is to separate fields from a file
that are separated by an arbitrary amount of whitespace.  This would
return the first and second columns with only a single space in
between:

awk '{print $1 " " $2}'

> cat /etc/passwd | awk -F : '{ print $1 }'

Actually, this would be the same with awk:

awk -F : '{print $1}' < /etc/passwd

Yours would win the "Useless Use of Cat Award":

http://www.iki.fi/era/unix/award.html

That page actually has a lot of useful tips and tricks for shell
programming.  I was previously unaware of this construct:

</etc/passwd cut -d: -f1

I think most people use cat because it's more intuitive.  You might
use cat to view a file, then decide to grep it, and it's faster to
simply add the pipe to grep on the end of the command line.  Also,
having the input redirection after the command feels backwards.
Obviously, the only time it's really an issue is in a loop, in a
frequently run script, or on a machine that has a slow CPU or is low
on memory.

-- 
David Phillips <david at acz.org>
http://david.acz.org/

_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
Help beta test TCLUG's potential new home: http://plone.mn-linux.org
Got pictures for TCLUG? Beta test http://plone.mn-linux.org/gallery
tclug-list at mn-linux.org
https://mailman.real-time.com/mailman/listinfo/tclug-list