Unnecessarily long pipelines (was Re: How do you handle while(1) fork(); ?)
Geoff Clare
gwc at root.co.uk
Wed Jul 18 20:59:12 AEST 1990
In <price.648165820 at chakra> price at chakra.unl.edu (Chad Price) writes:
>z=`ps -aug | grep $2 | grep -v grep | grep -v csh | grep -v kill | awk '{ print $2 }'`
I usually just chuckle to myself when I see things like this, but I decided
this time it's worth a comment.
Why is it that people string together lots of "grep" commands in a
pipeline, when they could do the same job with a single "sed" or "awk"
command? In this case it's even worse, because "awk" is already in
there as well!
--
Geoff Clare <gwc at root.co.uk> (Dumb American mailers: ...!uunet!root.co.uk!gwc)
UniSoft Limited, Hayne Street, London EC1A 9HH, England. Tel: +44-71-315-6600
More information about the Comp.unix.questions
mailing list