I see what you mean.
I changed the 1st if clause and my $vals, but now my output is spitting out the leading /.
open (my $ps, "-|", "/usr/bin/ps -o pcpu,vsz,stime,etime,pid,args -A|s
+ort -nk1") or die "ps not opened $!";
while (<$ps>) {
next if $. == 1;
next if /\/usr\/cachesys\/mgr -U/i; ### Skip interactive sessions
+###
#my @tmp = split if /cache/ig;
if ( /(cache\s-s.*)/ig ) {
#print $1,"\n";
my @tmp = split;
my ($key) = split " ",$tmp[0];
#my ($vals)= $_ =~ /([^cache]*)/;
my ($vals) = $_ =~ /\b\s|\d+\.\d+\s+\b(.*?)\b[\/usr|cache].*\b/;
print $vals,"\n";
}
#my @tmp1=@tmp[1,2,3,4];
#$psH{$key} = [@tmp1];
}
#use Data::Dumper;
__OUTPUT__
712 13:50:17 02:41:32 11354
7712 03:31:27 13:00:22 27747
22048 00:48:04 15:43:45 12141
7712 16:12:40 19:09 211
7712 10:51:28 05:40:21 15822
7712 15:50:39 41:10 27623 /
7712 15:50:39 41:10 27614 /
7712 15:50:39 41:10 27622 /
7712 15:50:39 41:10 27615 /
7712 15:50:39 41:10 27626 /
7712 15:50:39 41:10 27618 /
7712 15:50:39 41:10 27625 /
7712 15:50:39 41:10 27621 /
9760 15:50:39 41:10 27627 /
9760 15:50:39 41:10 27613 /
</code> |