ping命令格式化显示时间

个人学习笔记,谢绝转载!!!

原文:https://www.cnblogs.com/wshenjin/p/13260485.html


[root@ ]# ping 127.0.0.1 | awk '{printf strftime("%T");print "\t"$0}' 
17:20:50        PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
17:20:50        64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.088 ms
17:20:51        64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.099 ms
17:20:52        64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.100 ms
17:20:53        64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.087 ms
17:20:54        64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.099 ms
17:20:55        64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.105 ms
17:20:56        64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.101 ms
17:20:57        64 bytes from 127.0.0.1: icmp_seq=8 ttl=64 time=0.098 ms
posted @ 2020-07-10 17:21  wshenJin  阅读(1402)  评论(1编辑  收藏  举报