On Thursday 20 November 2008 16:41, Randall R Schulz wrote:
...
tstamp:
OK. I kind of like this one, so I elaborated it a bit: -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- #!/bin/bash --norc tsFormat='%F_%H.%M.%S' declare -i nErrors=0 for arg; do case "$arg" in +*) tsFormat="${arg#+}" ;; -*) echo "Unrecognized option: \"$arg\"" >&2 let nErrors++ ;; *) echo "Unrecognized argument: \"$arg\"" >&2 let nErrors++ ;; esac done if [ $nErrors -gt 0 ]; then exit $nErrors fi IFS= while read line; do echo "$(date +"$tsFormat: $line")" done -==--==--==--==--==--==--==--==--==--==--==--==--==--==--==- Examples: % vmstat 2 |tstamp 2008-11-20_16.42.02: procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- 2008-11-20_16.42.02: r b swpd free buff cache si so bi bo in cs us sy id wa 2008-11-20_16.42.02: 3 0 500168 68320 18948 315528 0 1 6 32 34 17 4 4 91 1 2008-11-20_16.42.04: 0 0 500168 68320 18948 315528 0 0 0 0 364 1404 1 3 96 0 2008-11-20_16.42.06: 1 0 500168 68048 18948 315528 0 0 0 25 370 1529 2 4 94 0 2008-11-20_16.42.08: 0 0 500168 66792 18948 315528 0 0 0 74 411 1832 7 4 89 0 % vmstat 2 |tstamp +'Right Now!' Right Now!: procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- Right Now!: r b swpd free buff cache si so bi bo in cs us sy id wa Right Now!: 3 0 500168 95732 19076 315808 0 1 6 32 34 17 4 4 91 1 Right Now!: 0 0 500168 95360 19076 315808 0 0 0 3 361 1471 1 3 96 0 Right Now!: 0 0 500168 95360 19076 315808 0 0 0 0 461 1995 1 3 96 0 Right Now!: 0 0 500168 95268 19076 315808 0 0 0 27 372 1470 1 3 96 0 % vmstat 2 |tstamp +'%F_%H.%M.%S.%N' 2008-11-20_16.49.46.579369000: procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- 2008-11-20_16.49.46.582225000: r b swpd free buff cache si so bi bo in cs us sy id wa 2008-11-20_16.49.46.585086000: 1 0 500168 95216 19108 316072 0 1 6 32 34 18 4 4 91 1 2008-11-20_16.49.48.580113000: 3 0 500168 95216 19108 316072 0 0 0 23 364 1429 1 3 95 0 2008-11-20_16.49.50.583866000: 0 0 500168 95092 19108 316072 0 0 0 3 364 1424 1 3 97 0 % vmstat 2 |tstamp +%s 1227228626: procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- 1227228626: r b swpd free buff cache si so bi bo in cs us sy id wa 1227228626: 2 0 500168 94940 19124 315928 0 1 6 32 34 18 4 4 91 1 1227228628: 3 0 500168 94816 19124 315928 0 0 0 13 408 1619 2 3 95 0 1227228630: 0 0 500168 94692 19124 315928 0 0 0 3 399 1609 1 3 96 0 Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org