summaryrefslogtreecommitdiff
path: root/usr.sbin/traceroute/mean.awk
blob: 75cc421a60a121c0fcf7a48be5d8c895a79c3d08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/awk -f
#	$NetBSD: mean.awk,v 1.5 1997/10/04 16:31:29 christos Exp $
/^ *[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
}