No worries :-)

It works now, thanks a lot :-)

Best regards,

Steve Hemond
Programmeur Analyste / Analyst Programmer
Smurfit-Stone, Ressources Forestières
La Tuque, P.Q.
Tel.: (819) 676-8100 X2833
[EMAIL PROTECTED] 



 > -----Original Message-----
 > From: drieux [mailto:[EMAIL PROTECTED] 
 > Sent: Wednesday, December 17, 2003 1:38 PM
 > To: Perl Perl
 > Subject: Re: RE : RE : RE : Regular expressions
 > 
 > 
 > 
 > On Dec 17, 2003, at 10:24 AM, drieux wrote:
 > 
 > >
 > >    open(PS, "ps -efA|") or die "unable to open ps command\n:$!";
 > >     while (<PS>) {
 > >            ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split;
 > >            print "$pid -> $cmd\n";
 > >    }
 > >    close(PS);
 > 
 > Tell me not to make my coffee with last night's bong water!
 > if split is splitting on the default blank space,
 > 
 >      root     $1
 >      1644     $2
 >      1               $3
 >      0               $4
 >      Nov10   $5
 >      ?       $6
 >      00:00:00  $7
 >      /usr/sbin/httpd2-prefork  $8
 > 
 >      -f /etc/apache2/httpd.conf
 > 
 > what we want is the saner process of
 > 
 >      ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split(/\s+/,$_,8);
 > 
 > eg:
 > 
 > sed 's/^/### /' junk.plx
 > ### #!/usr/bin/perl -w
 > ### use strict;
 > ###
 > ### open(PS, "ps -efAww | grep http|");
 > ### while(<PS>)
 > ### {
 > ### #   my ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split;
 > ### #           print "$pid -> $cmd\n";
 > ### my  ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = 
 > split(/\s+/,$_,8);
 > ###     print "Better $pid -> $cmd\n";
 > ###     print "\t$uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd\n";
 > ###
 > ### }
 > 
 > My Apology!
 > 
 > ciao
 > drieux
 > 
 > ---
 > 
 > 
 > -- 
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED] 
<http://learn.perl.org/> <http://learn.perl.org/first-response>


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


Reply via email to