是否可以将每个ping数据包的系统时间放在ping之前?
例如,当我每秒ping 1000次时,我们会看到类似这样的事情:# ping 9.0.0.150 -i 0.001
PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data.
64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms
64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms
64 bytes from 9.0.0.150: icmp_req=3 ttl=64 time=0.472 ms
64 bytes from 9.0.0.150: icmp_req=4 ttl=64 time=0.497 ms
我想要的是这样的:
# ping 9.0.0.150 -i 0.001
PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data.
12345123.122122 64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms
12345123.123122 64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms
12345123.124122 64 bytes from 9.0.0.150: icmp_req=3 ttl=64 time=0.472 ms
12345123.125122 64 bytes from 9.0.0.150: icmp_req=4 ttl=64 time=0.497 ms
其中前缀中的数字是系统时间。
答案 0 :(得分:1)
这样的事可能吗?
ping 9.0.0.150 -i 0.001 | while read line
do
echo $(cut -f1 -d' ' /proc/uptime) $line
done