Killing with awk vs. cut
Scott "The Pseudo-Hacker" Neugroschl
abcscnge at csuna.csun.edu
Wed Aug 23 16:46:01 AEST 1989
In article <20608 at adm.BRL.MIL> ritter at cs.msstate.edu (Thomas H. Ritter) writes:
]In a recent article:
]All the solutions I saw used awk to get the second column of the
]ps listing. Why use such a general purpose tool for so simple
]a task? SystemV provides the cut command. eg.
]
]kill `ps -aux | fgrep -e -sleeper | egrep -v fgrep | cut -d" " -f5`
The problem with cut is that if you specify the delimiter with -d, then
consecutive delimiters will return empty strings: e.g.
a<blank><blank>b
where <blank> is a single blank:
cut -d" " -f2 returns an empty string, and cut -d" " -f3 returns the b
Scott
--
Scott "The Pseudo-Hacker" Neugroschl
UUCP: ...!sm.unisys.com!csun!csuna.csun.edu!abcscnge
-- Beat me, Whip me, make me code in Ada
-- Disclaimers? We don't need no stinking disclaimers!!!
More information about the Comp.unix.questions
mailing list