The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Searching and extracting text from output sjday Shell Programming and Scripting 3 12-07-2007 01:12 AM
Extracting fields from an output 8-) csaha Shell Programming and Scripting 6 01-20-2006 05:37 AM
ICMP Echo-Request ilmora UNIX for Advanced & Expert Users 5 10-27-2005 07:09 AM
Linux and ICMP timestamp requests. gerwhelan Linux 2 10-06-2003 04:44 AM
icmp seccom IP Networking 1 08-01-2001 10:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-03-2008
Paris Heng's Avatar
Registered User
 

Join Date: Jan 2008
Location: Kuala Lumpur, MY
Posts: 4
Extracting ICMP Output for Plotting

Dear,

I want to perform a plotting using xgraph, and the plotting data (ping.txt) is as below. For the graph I just want to plot the time for x-axis (line count) and the RTT for y-axis (time in ms). Below are script i write for that purpose but it seen did not work. Any guide for me because i think the script is wrong. The example of plot is about like this:



ping.txt
-------------------------------------------------------------
64 bytes from 192.168.1.100: icmp_seq=0 ttl=255 time=0.712 ms
64 bytes from 192.168.1.100: icmp_seq=1 ttl=255 time=0.620 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=255 time=0.698 ms
64 bytes from 192.168.1.100: icmp_seq=3 ttl=255 time=0.662 ms
64 bytes from 192.168.1.100: icmp_seq=4 ttl=255 time=0.649 ms
-------------------------------------------------------------

Quote:
#!/bin/sh
#For x-axis (Time)
wc -l ping.txt > plot.txt

#For y-axis (RTT)
ping.txt | awk '{print $7}' > plot.txt

#Plotting graph using xgraph
xgraph -bb -tk -x "Time" -y "RTT" plot.txt
Intended plot.txt
-----------------
1 0.712
2 0.620
3 0.698
4 0.662
5 0.649
-----------------
Reply With Quote
Forum Sponsor
  #2  
Old 02-04-2008
rikxik's Avatar
Registered User
 

Join Date: Dec 2007
Posts: 105
I have a feeling that this is not all you need - but anyway:

Code:
$ cat ping.txt
64 bytes from 192.168.1.100: icmp_seq=0 ttl=255 time=0.712 ms
64 bytes from 192.168.1.100: icmp_seq=1 ttl=255 time=0.620 ms
64 bytes from 192.168.1.100: icmp_seq=2 ttl=255 time=0.698 ms
64 bytes from 192.168.1.100: icmp_seq=3 ttl=255 time=0.662 ms
64 bytes from 192.168.1.100: icmp_seq=4 ttl=255 time=0.649 ms
$
$ awk '{split($7,a,"="); print NR, a[2];}' ping.txt
1 0.712
2 0.620
3 0.698
4 0.662
5 0.649
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0