in reply to Re^2: Perl grep the pid and cal time taken
in thread Perl grep the process id and calculate time taken
Given the complexity of the piping you are doing, I wonder about why you are invoking perl here at all. Perl has powerful internal structures that are intended as stand-ins for the command line utilities, so it would make a lot more sense to grab the entire output from ps and then filter it in Perl:
Of course, the output of ps -ef on my box doesn't have STIME that looks like the date in your command, so you probably want to debug that. You seem to be confusing your various input streams.for (`ps -ef`) { my ($user, $pid, $ppid, $c, $stime, $tty, $time, $cmd) = split /\s ++/, $_, 8; next unless $user eq 'acuser'; ... }
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|