Killing with awk and grep

Usenet file owner usenet at cps3xx.UUCP
Fri Aug 11 13:34:20 AEST 1989


in article <303 at opus.NMSU.EDU>, tgardenh at nmsu.edu (Tricia Gardenhire) says:
> 
> Hi, I've been reading the man pages for awk, but they just aren't that
> helpful.  So here is my question:  I want to create a shell script
> that will look at ps -aux for a certain process called '-sleeper' and
> then kill it.  I've figured out how to search for it using grep and

ps -axe | grep pattern | grep -v grep | awk '{print "kill -9 " $1}' | sh


Robert Raisch - TechnoJunkie & UnixNut| UseNet: {uunet,mailrus}!frith!raisch
Network Software Group-301 Comp.Center| InterNet: raisch at frith.egr.msu.edu 
Michigan State University, E. Lansing | ICBMNet: 084 28 50 W / 42 43 29 N
----- The meek WILL inherit the Earth, (Some of us have other plans). ------



More information about the Comp.unix.questions mailing list