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

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to