Extracting avg latency value from ping output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting avg latency value from ping output
# 1  
Old 07-20-2011
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

Code:
Router#ping 36.36.36.36

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 36.36.36.36, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/7 ms

# 2  
Old 07-20-2011
Code:
awk -F\/ '/round-trip/ {print $5}' infile > newfile

# 3  
Old 07-20-2011
here is one..

Code:
pingcommand | tail -1| cut -d"=" -f2 | cut -d"/" -f2 > anyfilename

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

Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team, Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail. Need this script to check reachability of multiple nodes at same time. Help me. I use this but not working... Eg. in this script i need to telnet... (4 Replies)
Discussion started by: Ganesh Mankar
4 Replies

3. 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

4. Shell Programming and Scripting

Suppress the output of ping

Hi All, I just wanted to know, is there a way to suppress the output of the following i.e. the output should not be written on the screen: ping 10.1.23.234 -n 1 PING 10.1.23.234: 64 byte packets 64 bytes from 10.1.23.234: icmp_seq=0. time=0. ms ----10.1.23.234 PING Statistics---- 1... (2 Replies)
Discussion started by: ss_ss
2 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. Shell Programming and Scripting

Extracting Latency, Loss and Jitter from PING responses.

I have a script that pings several hosts and stores the response in a text file (see below) Once this file is created, the intention is to populate a database with the values for 'packet loss', 'avg' and 'mdev', but first I have to extract this data. avg=latency mdev = jitter packet... (5 Replies)
Discussion started by: tony.kandaya
5 Replies

7. Shell Programming and Scripting

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... (1 Reply)
Discussion started by: Paris Heng
1 Replies

8. 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

9. 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

10. Shell Programming and Scripting

Ping: redirect output and error

Hi, I use this function (now modified with elif) for check if a pc is up: check_pc() { $PING $PC 1 2> /dev/null if ; then check_dir #Other function echo "Begin backup operation for $PC" echo "$SMBTAR -s $PC -u $USER -p $PASS -x $SHARE$EXCL -t - | gzip -c >... (3 Replies)
Discussion started by: mbarberis
3 Replies
Login or Register to Ask a Question