Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A perl version' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A perl version
Authored by: adamjacobmuller on Jun 21, '03 07:01:13PM

the last one was wrong as well... i double quoted it.

this is RIGHT!!! I swear!!!!

<code>
#!/usr/bin/perl
@procs = `ps -cxa`;
for $proc (@procs ) {
if( $proc =~ /\s+(\d+)\s+\S+\s+\S+\s+\S+\s+(\S+)/ ) {
$pid = $1;
$name = $2;
if( $name =~ /$ARGV[0]/ ) {
print "$pid ";
}
}
}

print "\n";
</code>



[ Reply to This | # ]