SUMMARY: Modifying SAR Output

From: Hackett, Peter (PHackett@talisman-energy.com)
Date: Thu Oct 07 2004 - 14:34:56 EDT


Thanks to DJ Gregor and Elvio Prattico who both provided quick & easy awk
scripts for this..

This one from DJ (which was the fastest by about 200%):
#!/usr/bin/awk -f

$0 !~ /^ / {
        time = $1;
        print;
}

$0 ~ /^ / {
        print time substr($0, length(time) + 1);
}

And this one from Elvio:
#!/bin/sh

awk '{

if ( NF == 1 ) continue
if ( NF == 8 ) { TS=$1; print $0 }
if ( NF == 7 ) printf("%s %s\n",TS,$0)

}' sar.out

Thanks!

Pete

> -----Original Message-----
> From: Hackett, Peter
> Sent: Thursday, October 07, 2004 11:30 AM
> To: 'sunmanagers@sunmanagers.org'
> Subject: Modifying SAR Output
>
>
> Good day. I'm trying to digest some sar -d output, but I need
> to fill in the missing times for each device so I can
> autofilter by device in excel... but there's simply too many
> to do manually. I need to script something so the time will
> be continued on in the columns for each device, until the
> next time stamp. (there's actually more than 200 entries
> between each timestamp, i've just cut them out for
> demonstration here...
>
> What can I run this through to fill in the blank times. I'm
> looking for either an awk/perl script solution, but if anyone
> know how to also do this in excel, that would work too..
> ultimately i just need the data so each row has a time so I
> can explore a performance problem.
>
> 00:05:00 md0 1 0.0 1 6 4.0 17.6
> md1 1 0.0 1 5 0.0 16.1
> md2 1 0.0 1 5 0.0 15.1
> md5 0 0.0 0 0 0.0 0.0
> md6 0 0.0 0 0 0.0 0.0
> md7 0 0.0 0 0 0.0 0.0
> md10 0 0.0 0 1 8.2 7.2
> md11 0 0.0 0 1 0.0 5.8
> md12 0 0.0 0 1 0.0 6.2
> md15 1 0.0 1 10 0.3 8.1
> md16 1 0.0 1 8 0.0 7.1
> md17 1 0.0 1 9 0.0 7.4
> nfs2 0 0.0 0 0 0.0 0.0
> nfs106 0 0.0 0 2 0.0 59.9
>
>
> 00:10:00 md0 0 0.0 1 15 4.1 16.6
> md1 0 0.0 1 10 0.0 15.6
> md2 0 0.0 1 10 0.0 15.3
> md5 0 0.0 0 0 0.0 0.0
> md6 0 0.0 0 0 0.0 0.0
> md7 0 0.0 0 0 0.0 0.0
> md10 0 0.0 0 1 7.6 7.3
> md11 0 0.0 0 1 0.0 6.8
> md12 0 0.0 0 1 0.0 7.2
> md15 1 0.0 1 14 0.1 7.5
> md16 1 0.0 1 14 0.0 6.9
> md17 1 0.0 1 14 0.0 7.0
> nfs2 0 0.0 0 0 0.0 0.0
> nfs106 0 0.0 0 0 0.0 2.1
>
> Any and all help appreciated.
>
> Thanks,
>
> Peter
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:29:32 EDT