On Sat, 2007-02-03 at 10:59 -0700, Bob Proulx wrote:
> 
>   echo one two three four five six seven | awk '{print$2,$NF}'
>   two seven

That one always drives me nuts.  Why fork/exec for such a heavy process
for something bash can do itself:

cat $file | while read column1 rest; do
    echo $column1
done

Or if you need the data in the calling shell's context:

while read column1 rest; do
    # the goodies are in $column1
done < <(cat $file)

Probably a dozen other ways to do it too.

b.

-- 
My other computer is your Microsoft Windows server.

Brian J. Murrell

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to