Sponsored Content
Top Forums Shell Programming and Scripting Count time min/max/average for ping Post 302538181 by zorrox on Tuesday 12th of July 2011 03:49:55 AM
Old 07-12-2011
Count time min/max/average for ping

I am redirecting my ping output to a file. The sample output is like this:

Code:
64 bytes from xx.xx.xx.167: icmp_seq=4490 ttl=116 3.75 ms 2011Jul12- 15 40 16
64 bytes from xx.xx.xx.167: icmp_seq=4491 ttl=116 5.29 ms 2011Jul12- 15 40 17
64 bytes from xx.xx.xx.167: icmp_seq=4492 ttl=116 4.88 ms 2011Jul12- 15 40 18
64 bytes from xx.xx.xx.167: icmp_seq=4493 ttl=116 4.33 ms 2011Jul12- 15 40 19
64 bytes from xx.xx.xx.167: icmp_seq=4494 ttl=116 3.93 ms 2011Jul12- 15 40 20
64 bytes from xx.xx.xx.167: icmp_seq=4495 ttl=116 4.05 ms 2011Jul12- 15 40 21
64 bytes from xx.xx.xx.167: icmp_seq=4496 ttl=116 3.33 ms 2011Jul12- 15 40 22
64 bytes from xx.xx.xx.167: icmp_seq=4497 ttl=116 4.23 ms 2011Jul12- 15 40 23
64 bytes from xx.xx.xx.167: icmp_seq=4498 ttl=116 3.59 ms 2011Jul12- 15 40 24
64 bytes from xx.xx.xx.167: icmp_seq=4499 ttl=116 3.57 ms 2011Jul12- 15 40 25
64 bytes from xx.xx.xx.167: icmp_seq=4500 ttl=116 5.27 ms 2011Jul12- 15 40 26
64 bytes from xx.xx.xx.167: icmp_seq=4501 ttl=116 4.51 ms 2011Jul12- 15 40 27
64 bytes from xx.xx.xx.167: icmp_seq=4502 ttl=116 3.45 ms 2011Jul12- 15 40 28
64 bytes from xx.xx.xx.167: icmp_seq=4503 ttl=116 4.16 ms 2011Jul12- 15 40 29
64 bytes from xx.xx.xx.167: icmp_seq=4504 ttl=116 3.34 ms 2011Jul12- 15 40 30
64 bytes from xx.xx.xx.167: icmp_seq=4505 ttl=116 4.59 ms 2011Jul12- 15 40 31
64 bytes from xx.xx.xx.167: icmp_seq=4507 ttl=116 3.46 ms 2011Jul12- 15 40 33
64 bytes from xx.xx.xx.167: icmp_seq=4508 ttl=116 5.34 ms 2011Jul12- 15 40 34


The reply time (rtt) is the seventh field (e.g. 5.34 for the last line).
How can I use awk to produce minimum, maximum and average for the rtt from all lines in the file? How to do it without awk?

Last edited by radoulov; 07-12-2011 at 08:29 AM.. Reason: Code tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

min and max value of process id

We are running a AIX 5.2 OS. Would anyone happen to know what the max value for a process id could be? Thanks jerardfjay :) (0 Replies)
Discussion started by: jerardfjay
0 Replies

2. UNIX for Dummies Questions & Answers

Iterate a min/max awk script over time-series temperature data

I'm trying to iterate a UNIX awk script that returns min/max temperature data for each day from a monthly weather data file (01_weath.dat). The temperature data is held in $5. The temps are reported each minute so each day contains 1440 temperature enteries. The below code has gotten me as far as... (5 Replies)
Discussion started by: jgourley
5 Replies

3. Shell Programming and Scripting

get min, max and average value

hi! i have a file like the attachement. I'd like to get for each line the min, max and average values. (there is 255 values for each line) how can i get that ? i try this, is it right? BEGIN {FS = ","; OFS = ";";max=0;min=0;moy=0;total=0;freq=890} $0 !~ /Trace1:/ { ... (1 Reply)
Discussion started by: riderman
1 Replies

4. Shell Programming and Scripting

How to find the average,min,max ,total count?

Hi , Below is my sample data,I have this 8 column(A,B,C,D,E,F,G,H) in csv file. A , B ,C ,D ,E ,F,G ,H 4141,127337,24,15,20,69,72.0,-3 4141,128864,24,15,20,65,66.0,-1 4141,910053,24,15,4,4,5.0,-1 4141,910383,24,15,22,3,4.0,-1 4141,496969,24,15,14,6,-24.0,-18... (7 Replies)
Discussion started by: vinothsekark
7 Replies

5. Shell Programming and Scripting

Number of elements, average value, min & max from a list of numbers using awk

Hi all, I have a list of numbers. I need an awk command to find out the numbers of elements (number of numbers, sort to speak), the average value the min and max value. Reading the list only once, with awk. Any ideas? Thanks! (5 Replies)
Discussion started by: black_fender
5 Replies

6. Shell Programming and Scripting

Average, min and max in file with header, using awk

Hi, I have a file which looks like this: FID IID MISS_PHENO N_MISS N_GENO F_MISS 12AB43131 12AB43131 N 17774 906341 0.01961 65HJ87451 65HJ87451 N 10149 906341 0.0112 43JJ21345 43JJ21345 N 2826 906341 0.003118I would... (11 Replies)
Discussion started by: kayakj
11 Replies

7. Shell Programming and Scripting

Get min and max value in column

Gents, I have a big file file like this. 5100010002 5100010004 5100010006 5100010008 5100010010 5100010012 5102010002 5102010004 5102010006 5102010008 5102010010 5102010012 The file is sorted and I would like to find the min and max value, taking in the consideration key1... (3 Replies)
Discussion started by: jiam912
3 Replies

8. Shell Programming and Scripting

Find min and max time taken from a log file

You have a log file as attached in sample input with various operations and time taken by each of them. Write a script to find the min and max time taken for each operation. Sample output is attached. Sample Input is given as below: operation1,83621 operation2,72321 operation3,13288... (1 Reply)
Discussion started by: Chandan_Bose
1 Replies

9. UNIX for Beginners Questions & Answers

How to count average and max respon time?

sorry i will revise first (1 Reply)
Discussion started by: fajar_3t3
1 Replies

10. UNIX for Beginners Questions & Answers

How to count respon time max min avg for nginx logs?

Hi All, need your help, i want count respon time max and average my nginx logs, based on hourly or minutes per api... my nginx.log sample : 10.1.1.1 - - "POST /v2/api/find/outlet/ HTTP/1.1" 200 2667 "-" "okhttp/3.12.0" "118.215.153.47" 0.178 0.178 . 10.1.1.1 - - "POST... (4 Replies)
Discussion started by: fajar_3t3
4 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l- SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> ldns_zone_new(); void ldns_zone_deep_free(ldns_zone *zone); ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c); ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr); DESCRIPTION
ldns_zone_new() ldns_zone_deep_free() Frees the allocated memory for the zone, the soa rr in it, and the rr_list structure in it, including the rr's in that. etc. zone: the zone to free ldns_zone_new_frm_fp() Create a new zone from a file z: the new zone *fp: the filepointer to use *origin: the zones' origin ttl: default ttl to use c: default class to use (IN) Returns ldns_status mesg with an error or LDNS_STATUS_OK ldns_zone_new_frm_fp_l() Create a new zone from a file, keep track of the line numbering z: the new zone *fp: the filepointer to use *origin: the zones' origin ttl: default ttl to use c: default class to use (IN) line_nr: used for error msg, to get to the line number Returns ldns_status mesg with an error or LDNS_STATUS_OK AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_zone. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 01:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy