DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Legacy and Other Languages (http://www.daniweb.com/forums/forum42.html)
-   -   killing PIDs from a file (http://www.daniweb.com/forums/thread157400.html)

Trekker182 Nov 14th, 2008 3:58 pm
killing PIDs from a file
 
What is the best way to kill a number of PIDs that I've isolated from an external file?

So far I've done grep PID badPids | awk {'print$2}'

to get the list of bad PIDS to kill. I've searched through the man pages to no avail and I need to be able to do it from the terminal line, not a script file.

I know that kill -k will do it, but I'm not sure on how to pass the list to kill.

Thanks.

Rashakil Fol Nov 15th, 2008 11:06 pm
Re: killing PIDs from a file
 
awk '{ system("kill " $2) }'

Trekker182 Nov 16th, 2008 12:09 am
Re: killing PIDs from a file
 
Thanks! That did it...


All times are GMT -4. The time now is 11:46 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC