Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I've written a one line script to consolidate ping stats for each device being pinged from a list of 30 devices. I am using a for-do loop and extracting and formatting the values. But I'm having problems extracting just the average value:
My output so far looks like this:
MyCity to device.domain.com (10.10.10.12): 04-30-08 13:05:00 min/avg/max = 103/106/113
I need it to show only the average value, like this:
MyCity to device.domain.com (10.10.10.12): 04-30-08 13:05:00 avg = 106How can I accomplist this since the value average is not always 3 characters? I tried using nawk and sed, but no luck yet extracting just the average for each ping result.
Thanks

Try using AWK with the slash as a separator:
echo min/avgavgavg/max = 103/106/113 | awk -F"/" ' { print $4 } '
Not 100% sure on syntax, but you might get the idea

![]() |
OpenWindows loads instead...
|
Software Mirror (RAID 1)
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |