NetBSD/usr.sbin/traceroute/mean.awk

15 lines
296 B
Awk
Raw Normal View History

1993-03-21 12:45:37 +03:00
#!/bin/awk -f
1997-10-04 20:31:24 +04:00
# $NetBSD: mean.awk,v 1.5 1997/10/04 16:31:29 christos Exp $
1993-03-21 12:45:37 +03:00
/^ *[0-9]/ {
# print out the average time to each hop along a route.
tottime = 0; n = 0;
for (f = 5; f <= NF; ++f) {
if ($f == "ms") {
tottime += $(f - 1)
++n
}
}
if (n > 0)
print $1, tottime/n, median
}