ANSI, minor cleanups
[unix-history] / usr / src / usr.sbin / traceroute / mean.awk
CommitLineData
296ce596
KB
1#!/bin/awk -f
2#
3# Copyright (c) 1990 The Regents of the University of California.
4# All rights reserved.
5#
6# This code is derived from software contributed to Berkeley by
7# Van Jacobson.
8#
9# %sccs.include.redist.sh%
10#
11# @(#)mean.awk 5.2 (Berkeley) %G%
12#
4b88417b
KB
13/^ *[0-9]/ {
14 # print out the average time to each hop along a route.
15 tottime = 0; n = 0;
16 for (f = 5; f <= NF; ++f) {
17 if ($f == "ms") {
18 tottime += $(f - 1)
19 ++n
20 }
21 }
22 if (n > 0)
23 print $1, tottime/n, median
24}