以人性化的方式,使用awk,tail显示emerge.log日期

・1 分钟阅读

以人性化的方式显示emerge.log日期

tail /var/log/emerge.log | awk -F: '{print strftime("%Y%m%d %X %Z", $1),$2}'
仅用于gentoo或类似gentoo的linux发行版。
示例输出
20100411 08:30:07 AM UTC *** exiting unsuccessfully with status '1'.
20100411 08:30:07 AM UTC *** terminating.
20100412 08:30:03 AM UTC Started emerge on
20100412 08:30:03 AM UTC *** emerge --quiet metadata
20100412 08:30:07 AM UTC *** exiting unsuccessfully with status '1'.
20100412 08:30:07 AM UTC *** terminating.
Hujiuxiang profile image