linux - 如何在不显示时间的命令的输出中强行插入时间?
怪我咯
怪我咯 2017-04-17 14:21:03
0
1
665

我使用【iftop -P -l -n -N -B -t】来监控网络,直接输出到日志。
但我发现这款工具,居然不记录时间。

因此,像这种不输出时间的监控工具,如何在它的输出里强行加入时间?

难道只能改源码吗?
谢谢~

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
小葫芦

Use awk, for example, when I ping Baidu:

$ ping www.baidu.com | awk '{ print rrreee"\t",system("date")} '
PING www.a.shifen.com (119.75.217.109): 56 data bytes     2016年 2月25日 星期四 23时22分45秒 CST
0
64 bytes from 119.75.217.109: icmp_seq=0 ttl=48 time=31.877 ms     2016年 2月25日 星期四 23时22分45秒 CST
0
64 bytes from 119.75.217.109: icmp_seq=1 ttl=48 time=32.985 ms     2016年 2月25日 星期四 23时22分46秒 CST
0
64 bytes from 119.75.217.109: icmp_seq=2 ttl=48 time=31.856 ms     2016年 2月25日 星期四 23时22分47秒 CST
0
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!