Re: Programmatic Parsing of ps

2011-02-10 Thread bsergean
If you're on Linux you should * Have a look at the /proc/ filesystem, there's probably what you want there. Here's a small script that print all the pid/cmd from the process ran with your user. #!/usr/local/bin/python import os import re import stat from os.path import join for pid in (pid

Re: Programmatic Parsing of ps

2011-02-10 Thread James Mills
On Thu, Feb 10, 2011 at 4:58 AM, octopusgrabbus old_road_f...@verizon.net wrote: I have Python 2.6.6. I would like to get this output ps -ef | grep 'fglgo csm' into a list. What is the best way to do that? I've been reading the documentation, and am lost. Have you checked out psutil (1) to

Re: Programmatic Parsing of ps

2011-02-10 Thread Dan Stromberg
FWIW, Linux' /proc is very different from pretty much all other *ix's. I like Linux' design better, but it might be good to put the Linux /proc assumption in one place, in case you need to port to another *ix someday. On Thu, Feb 10, 2011 at 4:26 PM, bsergean bserg...@gmail.com wrote: If you're

Programmatic Parsing of ps

2011-02-09 Thread octopusgrabbus
I have Python 2.6.6. I would like to get this output ps -ef | grep 'fglgo csm' into a list. What is the best way to do that? I've been reading the documentation, and am lost. Thank you. cmn -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmatic Parsing of ps

2011-02-09 Thread Emile van Sebille
On 2/9/2011 10:58 AM octopusgrabbus said... I have Python 2.6.6. I would like to get this output ps -ef | grep 'fglgo csm' into a list. What is the best way to do that? I've been reading the documentation, and am lost. Thank you. cmn commands.getoutput Emile --

Re: Programmatic Parsing of ps

2011-02-09 Thread Dan Stromberg
On Wed, Feb 9, 2011 at 11:15 AM, Emile van Sebille em...@fenx.com wrote: On 2/9/2011 10:58 AM octopusgrabbus said... I have Python 2.6.6. I would like to get this output ps -ef | grep 'fglgo csm' into a list. What is the best way to do that? I've been reading the documentation, and am