perl 有毫秒
vmstat 1|perl -nle 'use POSIX 'strftime'; use Time::HiRes 'gettimeofday'; ($x,$y)=gettimeofday; $y=sprintf("%06d",$y);print strftime("%Y-%m-%d %H:%M:%S",localtime($x)),".$y $_"'
awk
vmstat 3 5 | awk '/^ *[0-9]/{$0=$0 " " strftime("%m-%d-%Y %T")};1'
sed
vmstat 3 5 | sed '/^ *[0-9].*/s/.*/printf "&";date "+ %m-%d-%Y %H:%M:%S"/e'
vmstat -v 3.2.8版以上
vmstat -t 1
© 2016, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com