Parsing results of ps?
From: Marv (marv_at_stevens.com)
Date: 10/30/03
- Next message: Gregory Toomey: "Re: Parsing results of ps?"
- Previous message: TDN: "Re: In search of elegant code: inverting a string"
- Next in thread: Gregory Toomey: "Re: Parsing results of ps?"
- Reply: Gregory Toomey: "Re: Parsing results of ps?"
- Reply: ko_: "Re: Parsing results of ps?"
- Reply: Jack D.: "Re: Parsing results of ps?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 03:31:53 GMT
Hello,
I'm a perl beginner and having trouble with what would appear like a
simple task.
I need to capture PID number from each line into a variable while in a
loop. The help I need is how to get to split each line of the output
so that I get the PID number regardless of how many digits long it is.
The output of ps -x gives me the pid number in the first column,
however it seems to be right justified in this column as such:
2193 ? S blahblah blah
26127 pts/0 S blahblah blah
4513 ? S blahblah blah
So when I try to do a split using a space as the delimiter some of the
variables end up empty.
How could I do this so that I always end up with the PID number?
Thanks,
Marv
- Next message: Gregory Toomey: "Re: Parsing results of ps?"
- Previous message: TDN: "Re: In search of elegant code: inverting a string"
- Next in thread: Gregory Toomey: "Re: Parsing results of ps?"
- Reply: Gregory Toomey: "Re: Parsing results of ps?"
- Reply: ko_: "Re: Parsing results of ps?"
- Reply: Jack D.: "Re: Parsing results of ps?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|