| Date: Fri, 13 Oct 2006 17:25:55 +0100
| From: "Robert Kiely" <robert.kiely at gmail.com>
|
| On 13/10/06, j michaelson <jmichaelson at gmail.com> wrote:
| > the final command should look something like....
| >
| > top -n 1 | grep ogg123 | ?????? | xargs kill -2
|
| Don't use top, use ps and then awk '{print $2}' to print second
| item on the line i.e. PID
ignoring that the killall(1) approach is, probably,
for the situation described, better, you can use
awk(1) to do more than just extract the PID (not
tested, but the intent should be clear):
ps -eo pid,cmd | awk '/ogg123/ { print "kill -2", $1 }' | bash
cheers!
-blf-
--
Experienced (20+ yrs) kernel/software Eng: | Brian Foster Montpellier,
• Unix, embedded, &tc; • Linux; • doc; | blf at utvinternet.ie FRANCE
• IDL, automated testing, process, &tc. | Stop E$$o (ExxonMobile)!
Résumé (CV) http://www.blf.utvinternet.ie | http://www.stopesso.com
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!