Computing.Net > Forums > Solaris > sell script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

sell script

Reply to Message Icon

Name: Hugo
Date: April 30, 2008 at 10:32:10 Pacific
OS: Sol 9
CPU/Ram: 4GB
Product: v240
Comment:

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 = 106

How 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



Sponsored Link
Ads by Google

Response Number 1
Name: tvc
Date: December 23, 2008 at 10:09:33 Pacific
Reply:

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


0
Reply to Message Icon

Related Posts

See More


OpenWindows loads instead... Software Mirror (RAID 1)


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: sell script

Issue expect scripting www.computing.net/answers/solaris/issue-expect-scripting/4230.html

An urgent script that copies files www.computing.net/answers/solaris/an-urgent-script-that-copies-files/3681.html

How to run script while startup CDE? www.computing.net/answers/solaris/how-to-run-script-while-startup-cde/1339.html