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
APC_STORE(3)								 1							      APC_STORE(3)

apc_store - Cache a variable in the data store

SYNOPSIS
bool apc_store (string $key, mixed $var, [int $ttl]) DESCRIPTION
array apc_store (array $values, [mixed $unused = NULL], [int $ttl]) Cache a variable in the data store. Note Unlike many other mechanisms in PHP, variables stored using apc_store(3) will persist between requests (until the value is removed from the cache). PARAMETERS
o $key - Store the variable using this name. $keys are cache-unique, so storing a second value with the same $key will overwrite the original value. o $var - The variable to store o $ttl - Time To Live; store $var in the cache for $ttl seconds. After the $ttl has passed, the stored variable will be expunged from the cache (on the next request). If no $ttl is supplied (or if the $ttl is 0), the value will persist until it is removed from the cache manually, or otherwise fails to exist in the cache (clear, restart, etc.). o $values - Names in key, variables in value. RETURN VALUES
Returns TRUE on success or FALSE on failure. Second syntax returns array with error keys. EXAMPLES
Example #1 A apc_store(3) example <?php $bar = 'BAR'; apc_store('foo', $bar); var_dump(apc_fetch('foo')); ?> The above example will output: string(3) "BAR" SEE ALSO
apc_add(3), apc_fetch(3), apc_delete(3). PHP Documentation Group APC_STORE(3)
All times are GMT -4. The time now is 09:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy