Pull out only first field of ps command ( in Perl ) PERL RUN COMMAND

Discussion in 'Perl Misc' started by tweetiebirds@gmail.com, Mar 26, 2005.

  1. Guest

    Hi,

    I want to filter out only the first column of the output of the ps -ae
    command in Perl using
    perl run-command.

    I.e using perl -pi -e etc....

    Anyone know how to do this ?

    I do NOT want to use UNIX cut.

    thanks
    T
     
    , Mar 26, 2005
    #1
    1. Advertising

  2. Jeff Guest

    Re: Pull out only first field of ps command ( in Perl ) PERL RUNCOMMAND

    wrote:
    > Hi,
    >
    > I want to filter out only the first column of the output of the ps -ae
    > command in Perl using
    > perl run-command.
    >
    > I.e using perl -pi -e etc....
    >
    > Anyone know how to do this ?
    >
    > I do NOT want to use UNIX cut.


    Did you try something? Can you post what you tried, so we can help you?

    I'd suggest a reading of 'perldoc perlrun'. You'll probably want to use
    a something like:

    ps -ae | perl -lane '<insert code here>'

    I'm going to leave the code itself as an exercise for you, and if you
    have problems post what you tried and I'll be happy to help you
    understand it better.

    ~Jeff
     
    Jeff, Mar 26, 2005
    #2
    1. Advertising

  3. <> wrote:
    >
    > I want to filter out only the first column of the output of the ps -ae
    > command in Perl using
    > perl run-command.
    >
    > I.e using perl -pi -e etc....
    >
    > Anyone know how to do this ?



    Yes.

    What have you tried so far?

    If you post your broken code we will help you fix it.


    > I do NOT want to use UNIX cut.



    Errr, OK.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Mar 26, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FjaGk=?=

    Need to pull out referance details

    =?Utf-8?B?U2FjaGk=?=, Sep 2, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    339
    =?Utf-8?B?Q2xpbnQgSGlsbA==?=
    Sep 2, 2005
  2. Bimo Remus

    pull out first and last words

    Bimo Remus, Jun 28, 2003, in forum: C++
    Replies:
    6
    Views:
    2,110
    Samuele Armondi
    Jun 29, 2003
  3. Replies:
    2
    Views:
    2,190
    Mike Treseler
    Jun 28, 2006
  4. Kun
    Replies:
    1
    Views:
    345
    Arne Ludwig
    Mar 25, 2006
  5. Sonu
    Replies:
    2
    Views:
    391
    Alex Popescu
    Aug 5, 2007
Loading...

Share This Page