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
Jean-François Pillou

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

Learn more about the CCM team

Published by . Latest update on by aakai1056.

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 (https://ccm.net/).

0 Comments