[lug] perl/awk question
Tkil
tkil at scrye.com
Sat May 20 01:52:49 MDT 2000
>>>>> "Chip" == Chip Atkinson <chip at rmpg.org> writes:
Chip> Here's something you might find useful for the same thing:
Chip> #!/usr/bin/perl
Chip> @psarr = `ps -ef`;
Chip> foreach $psline (@psarr)
Chip> {
Chip> if ($psline =~ /sendmail/ && $psline !~ /$0/)
Chip> {
Chip> @pidarr = split (/ +/, $psline);
Chip> print ("$pidarr[5]\n");
Chip> }
Chip> }
ObQuibble: you should make that -w and "use strict" safe, and you can
get rid of some of the extra work. :)
| #!/usr/bin/perl -w
|
| use strict;
|
| foreach (grep { /sendmail/ && !/$0/ } `/bin/ps -ef`)
| {
| print( (split)[5], "\n" );
| }
t.
More information about the LUG
mailing list