0
Thanks

A few words of thanks would be greatly appreciated.

Get a ping result with date and time



Issue


How to get a ping results with the date and time?

Solution


Try this:
$ ping -c 4 www.google.com | awk '/64/ {"date" | getline date ; print $0, "\t\t" date ; close("date")}'


Result:
64 bytes from mil01s16-in-f20.1e100.net (173.194.35.20): icmp_seq=1 ttl=56 time=20.1 ms Thu Mar 22 10:45:38 CET 2012
64 bytes from mil01s16-in-f20.1e100.net (173.194.35.20): icmp_seq=2 ttl=56 time=19.7 ms Thu Mar 22 10:45:39 CET 2012
64 bytes from mil01s16-in-f20.1e100.net (173.194.35.20): icmp_seq=3 ttl=56 time=19.7 ms Thu Mar 22 10:45:40 CET 2012
64 bytes from mil01s16-in-f20.1e100.net (173.194.35.20): icmp_seq=4 ttl=56 time=18.8 ms Thu Mar 22 10:45:41 CET 2012
$


Thanks to dubcek for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Related

This document, titled « Get a ping result with date and time », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments