File: mean.awk

package info (click to toggle)
traceroute 1.4a12-18
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 452 kB
  • ctags: 421
  • sloc: sh: 2,773; ansic: 2,540; makefile: 105; awk: 37
file content (12 lines) | stat: -rw-r--r-- 221 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
/^ *[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
}