Pinging Host

I need to ping websites and I need to see which one has the highest delay.

My problem is I need to extract the name Facebook and the time=74.0 ms using awk . I need help doing this please...

PING facebook.com (173.252.90.36) 56(84) bytes of data.
64 bytes from edge-star-mini-shv-13-atn1.facebook.com (173.252.90.36): icmp_req=1 ttl=76 time=74.0 ms

--- facebook.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 74.087/74.087/74.087/0.000 ms
PING pbs.org (23.21.237.247) 56(84) bytes of data.

You say you want to extract

Facebook

from the data you showed us, but that string does not appear anywhere in the data you showed us.

Are all of the time values in milliseconds? I.e., do you need to extract the string ms , or do you just need the number following time= ? (If you're trying to find a maximum time, it is much easier to get what you want if you are comparing numeric values instead of comparing alphanumeric strings. For example, as a number 11 is greater than 9, but the string "9 ms" is lexically greater than "11 ms".)

Why do you want "74 ms" instead of the "max" entry out of:

rtt min/avg/max/mdev = 74.087/74.087/74.087/0.000 ms

i.e., 74.087 ?

Do all of the ping entries you're processing just have one packet transmitted? (I.e., is what you showed us representative data of the input you're trying to process?)

You say you want to extract Facebook from the data you showed us, but that string does not appear anywhere in the data you showed us.

Are all of the time values in milliseconds? I.e., do you need to extract the string ms , or do you just need the number following time= ? (If you're trying to find a maximum time, it is much easier to get what you want if you are comparing numeric values instead of comparing alphanumeric strings. For example, as a number 11 is greater than 9, but the string "9 ms" is lexically greater than "11 ms".)

Why do you want "74 ms" instead of the "max" entry out of:

rtt min/avg/max/mdev = 74.087/74.087/74.087/0.000 ms

i.e., 74.087 ?

Do all of the ping entries you're processing just have one packet transmitted? (I.e., is what you showed us representative data of the input you're trying to process?)

What have you tried to solve this problem on your own?

I have to write a script that will ping a file with websites in it called host

the websites are

abz.com

I must write a script that will show which website has the highest delay. All i need is the name of the website and the [time = "number"]

PING facebook.com (173.252.90.36) 56(84) bytes of data.
64 bytes from edge-star-mini-shv-13-atn1.facebook.com (173.252.90.36): icmp_req=1 ttl=76 time=74.0 ms

--- facebook.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 74.087/74.087/74.087/0.000 ms
PING pbs.org (23.21.237.247) 56(84) bytes of data.

This is what i attempted to script I need help..

for websites in `cat hosts`

do
ping -c 1 $websites >> pingwebsites

echo "Please wait. Waiting to find the host with the highest delay !!!--->"

awk ' { print $2, $8 } ' pingwebsites >pingtimes

"I must write..." sounds like homework?

Sound like homework for me, too. Closed until proven otherwise...