Re: returning file info to C code
- From: rob.dixon@xxxxxxx (Rob Dixon)
- Date: Wed, 25 Jun 2008 12:13:44 +0100
shorti wrote:
Hello, I am a C coder but new to Perl. I am running in an AIX
environment. I was wondering if there was a Perl way to return string
data (or larger int values) to a C program? For instance, if I use
the command :
ps aux | grep process123 my out put would look like this:
emextra 45304 0.0 0.0 7344 6120 - A 20:08:01 0:00
process123
emextra 97034 0.0 0.0 3184 1984 - A 20:11:25 0:00
process123
emextra 123294 0.1 0.0 5100 3580 - A 20:06:47 0:37
process123
emextra 186828 0.0 0.0 2328 912 - A 20:07:22 0:02
db2agent (ERMM)
rsuser 8448 0.0 0.0 2900 284 - A 20:13:24 0:00
process123
rsuser 11576 0.0 0.0 2492 312 - A 20:13:24 0:00
process123
rsuser 14110 0.0 0.0 1576 288 - A 20:13:24 0:00
process123
rsuser 23584 0.0 0.0 2120 324 - A 20:13:24 0:00
process123
rsuser 24108 0.0 0.0 2540 280 - A 20:13:24 0:00
process123
rsuser 26800 0.0 0.0 1468 356 - A 20:13:24 0:00
process123
I want to retrieve the 2nd and 5th columns of the output. I *think* I
can figure out a way for Perl to get these columns but is there a way
to return these values to my C program?
Any advise would be appreciated
Piping your output through this Perl filter will do what you describe.
perl -ane "print qq(@F[1,4]\n)"
HTH,
Rob
.
- Follow-Ups:
- Re: returning file info to C code
- From: Shorti
- Re: returning file info to C code
- From: Shorti
- Re: returning file info to C code
- References:
- returning file info to C code
- From: Shorti
- returning file info to C code
- Prev by Date: Re: question on appending file
- Next by Date: Regular expressin
- Previous by thread: returning file info to C code
- Next by thread: Re: returning file info to C code
- Index(es):
Relevant Pages
|