Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Pull out only first field of ps command ( in Perl ) PERL RUN COMMAND

Reply
Thread Tools

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

 
 
tweetiebirds@gmail.com
Guest
Posts: n/a
 
      03-26-2005
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

 
Reply With Quote
 
 
 
 
Jeff
Guest
Posts: n/a
 
      03-26-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      03-26-2005
(E-Mail Removed) <(E-Mail Removed)> 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
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
how to run os.execv() to run command pslq dbname < gen.command Sonu Python 2 08-04-2007 11:25 PM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
weak pull up and pull down krithiga81@yahoo.com VHDL 2 06-28-2006 02:18 PM
pull out first and last words Bimo Remus C++ 6 06-29-2003 02:58 PM



Advertisments