2013-07-16 74 views
0

是否可以將系統時間放在每個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 

其中前綴號碼是系統時間。

回答

1

也許這樣的事情?

ping 9.0.0.150 -i 0.001 | while read line 
do 
    echo $(cut -f1 -d' ' /proc/uptime) $line 
done 
+0

謝謝!奇蹟般有效 – jaeyong