dmesg 的时间戳处理 |
发表者:admin分类:Devops2015-08-11 10:01:47 阅读[1911] |
dmesg 的时间戳处理
dmesg_with_human_timestamps () {
$(type -P dmesg) "$@" | perl -w -e 'use strict;
my ($uptime) = do { local @ARGV="/proc/uptime";<>}; ($uptime) = ($uptime =~ /^(\d+)\./);
foreach my $line (<>) {
printf( ($line=~/^\[\s*(\d+)\.\d+\](.+)/) ? ( "[%s]%s\n", scalar localtime(time - $uptime + $1), $2 ) : $line )
}'
}
alias dmesg=dmesg_with_human_timestamps
http://stackoverflow.com/questions/13890789/convert-dmesg-timestamp-to-custom-date-format
转载请标明出处【dmesg 的时间戳处理】。
《www.micoder.cc》
虚拟化云计算,系统运维,安全技术服务.
Tags: | [阅读全文...] |
最新评论