fvalente - 2016-03-04

Below perl script can be used to convert the sar file to 24 hours clock representation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/perl -w
while (<>)
{
    while (m%(\d\d)(?::\d\d:\d\d) (AM|PM)%)
    {
        my $hh = $1;
        $hh -= 12 if ($2 eq 'AM' && $hh == 12);
        $hh += 12 if ($2 eq 'PM' && $hh != 12);
        s%(\d\d)(:\d\d:\d\d) (?:AM|PM)%$hh$2%;
    }
    print;
}
 

Last edit: fvalente 2016-03-04