#!/bin/ksh
for F in "$@"; do sar -f $F; done | sed -n -e '
/\/[789][0-9]$/ { s:.*\(..\)/\(..\)/\(..\)$:19\3-\1-\2:; h; }
/\/[0-6][0-9]$/ { s:.*\(..\)/\(..\)/\(..\)$:20\3-\1-\2:; h; }
/\/[0-9]\{4\}$/ { s:.*\(..\)/\(..\)/\(....\)$:\3-\1-\2:; h; }
/%usr *%sys *%wio *%idle/ { s/^[^ ]*/ when/; p; }
/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9] *[0-9]/ { H; x; s/\n/ /; p; s/ .*//; h; }'
That's some horrible y2k work in there.
Am I the only one that wants a prepend command? The last line is an append, swap, print, then restore and push back to the hold space... i.e. a prepend!!
(I know awk might've been better suited. I was bored and wanted to sed.)
No comments:
Post a Comment