#!perl
use strict;
use warnings;
my $section = 0;
my ($time, $device, $util, $queue, $rws, $blks, $secs);
my @results;
open (LOG, '<', 'data.log') or die "Cannot open file data.log for inpu
+t: $!\n";
while (<LOG>) {
if (/^-+\s+/) {
++$section;
next;
}
if ($section == 2) {
next if (/^\s*$/);
@results = split;
next if (@results != 7);
if (!$util or $util < $results[2]) {
($time, $device, $util, $queue, $rws, $blks, $secs) = @result
+s;
}
}
}
print "Time: $time; device: $device; %util: $util\n";
print "r+w/s: $rws; blks/s: $blks; secs-avserv: $secs\n";
It selects the data with the highest %util value from the second part of the file.
Hope this helps, CombatSquirrel. |