"Tokinux" <(E-Mail Removed)> wrote:
>> I presume you mean the host's time and date, rather than the system
>> from which you send the "ping?"
>
>Uhmmmm not exactly......
>I will need a similar thing:
>
>09/12/2006 23.06 Reply to 192.168.0.1: byte=32 durata=6ms TTL=64
>09/12/2006 23.06 Reply to 192.168.0.1: byte=32 durata=100ms TTL=64
>09/12/2006 23.07 Reply to 192.168.0.1: byte=32 durata=100ms TTL=64
>
>Etc....
>
>It's possible?
>
>Thank you for your reply.
>
>Regards,
>
>Paolo
Here is something that will be very close. I'm not sure what
the exactly output from your particular ping program is, so I
can't make this match yours as opposed to mine. The script
output I get looks like this:
09/12/2006 15.04 192.168.1.103: icmp_seq=1 ttl=64 time=1.45 ms
However, the output from my ping, looks like this,
PING 192.168.1.103 (192.168.1.103) 56(84) bytes of data.
64 bytes from 192.168.1.103: icmp_seq=1 ttl=64 time=1.63 ms
And the script *depends* upon the first line *not* starting with
the same word as the other lines, and the lines of interest all
start with "64" and have exactly three words in front of the
data that is to be printed.
If you are not into shell programming, just post a few lines of
your ping output, and I'll be able to change the script to match.
#!/bin/bash
if [ -z "$1" ] ; then exit 1; fi
ping $1 | while read arg1 arg2 arg3 arg4 ; do
#
# The first line is a prefered format, the second line
# formats as requested.
#
date=$(/bin/date "+%m/%d/%Y %H.%M")
# date=$(/bin/date "+%Y-%m-%d %H.%M")
case $arg1 in
64*) echo -n "${date} $arg4" ;;
esac
done
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)
(E-Mail Removed)