[PLUG] Extracting the pid from ps -ax

Richard Steffens rsteff at attbi.com
Tue May 21 20:09:43 UTC 2002


sendai wrote:

> Just for variety you could do:
> 
> ps ax|grep mpg123|cut -d' ' -f1

For some reason, that doesn't work on my system. It's a minor variant on
one of the things I mention in my original post. I just had the -f1
before the -d' '. I tried your version just now, but all I get back is a
blank line. Not sure if I'm getting an empty line or a space on a line,
but it's not the pid.

"D. Cooper Stevenson" wrote:

> ps -e -o pid -o command | grep -v grep | grep mpg123
<snip> 
> The `grep -v grep' part strips out the grep process.

Interesting. I probably heard that in a class last year, but since I
haven't had a reason to use it have forgotten it. Thanks.

-- 
Regards,

Dick Steffens
"Quando Omni Flunkus Moritati"
http://rsteff.home.attbi.com/




More information about the PLUG mailing list