Extracting ICMP Output for Plotting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting ICMP Output for Plotting
# 1  
Old 02-04-2008
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:

Image

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
-----------------
# 2  
Old 02-04-2008
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

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting urls from curl output

Hello. I use curl to fetch a website, then, I want to extract the URLs from this curls output. I tried both sed and grep, but couldnt figure it out. Ive tried : sed -n 's/href="\(*\).*/\1/p' results.txt and grep -o grep -o '<a href="http://*.*.*/*">' results.txt. What pattern... (6 Replies)
Discussion started by: jozo95
6 Replies

2. Shell Programming and Scripting

Extracting lines after nth LINE from an output

Hi all, Here is my problem for which i am breaking my head for past three days.. I have parted command output as follows.. Model: ATA WDC WD5000AAKS-0 (scsi) Disk /dev/sdb: 500GB Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type ... (3 Replies)
Discussion started by: selvarajvs
3 Replies

3. Shell Programming and Scripting

Extracting avg latency value from ping output

Hello Everyone, Below is the output of the ping from a router. Please help with a script which extract the Avg value from the o/p (Avg here = 4, as depicted below) and put the value into a new file. Will appreciate your help dearly Router#ping 36.36.36.36 Type escape sequence to abort.... (2 Replies)
Discussion started by: sanjugab
2 Replies

4. UNIX for Dummies Questions & Answers

Help with extracting data and plotting

I have attached a txt file, what I would like to be able to do is: 1. Extract Data from Columns labeled E/N and Ko into a new file 2. Then in the new file I would like to be able to plot E/N on the X axis and Ko on the y axis. 3. Lastly I would like to be able to extract multiple data sets and... (6 Replies)
Discussion started by: gingburg
6 Replies

5. Shell Programming and Scripting

Extracting data from a shell output?

Hi all, I use a sh script to run few commands on CentOS 5.2. My goal is to search into test output for specific content and save it into a database table. So far everything is simple, except that I do not know how to grab the specific values: #!/bin/sh # Source function library. .... (13 Replies)
Discussion started by: TECK
13 Replies

6. IP Networking

Ping ICMP

Hi All, How to disable ICMP time stamp request and time stamp reply of a machine? How to test this feature from remote machine? Please reply back Vasanth (2 Replies)
Discussion started by: vasanthan
2 Replies

7. Shell Programming and Scripting

Searching and extracting text from output

I have the following output which I need to obtain the values for "Next Seq is xxx" and "Last Seq is xxx" and "Pending count is xxx". You will notice that the number of words prior to that value can be variable hence the reason for asking this question. LINECMD> Line /xxx///ABC9_SND is UP.... (3 Replies)
Discussion started by: sjday
3 Replies

8. Shell Programming and Scripting

Extracting fields from an output 8-)

I am getting a variable as x=2006/01/18 now I have to extract each field from it. Like x1=2006, x2=01 and x3=18. Any idea how? Thanks a lot for help. Thanks CSaha (6 Replies)
Discussion started by: csaha
6 Replies

9. UNIX for Dummies Questions & Answers

Help Plotting

I need to plot some files with the extension .plot, which I believe is a UNIX Plot(5) extension. Is UNIX Plot(5) something that I must download, or is it already built into UNIX? If it is already built in, is there a trick to actually plotting the files? Is there anything online that I could... (0 Replies)
Discussion started by: evenkolder
0 Replies

10. IP Networking

icmp

how i can send the big icmp packets to the another ip for loose connection ....or how he can loose (1 Reply)
Discussion started by: seccom
1 Replies
Login or Register to Ask a Question