Programmatic Parsing of ps

Dan Stromberg drsalists at gmail.com
Wed Feb 9 16:34:55 EST 2011


On Wed, Feb 9, 2011 at 11:15 AM, Emile van Sebille <emile at 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 lost.
>>
>> Thank you.
>> cmn
>
> commands.getoutput
>
> Emile

Also, consider using "ps -eo pid,comm" (or similar) instead of ps -ef
- it should be easier to parse that way.



More information about the Python-list mailing list