Assuming the file is too large to bring the whole thing into memory at once, I'd set your input record separator to "\nDATE ", and then each record can be picked apart rather easily.
use Date::Manip;
local $/ = "\nDATE ";
while (<>) {
my @l = split /\n/;
my @out;
push @out, UnixDate( shift(@l), "%m/%d" ); # from Date::Manip
for ( @l ) {
my %r;
@r{qw( pid user thr pri nice size res state time cpu comm )} =
+ split;
$r{'comm'} eq 'ns-httpd' and push @out, @r{qw( pid size )};
}
local $" = ",";
print "@out\n";
}
jdporter ...porque es dificil estar guapo y blanco. |