diff options
author | John Ankarström <john@ankarstrom.se> | 2020-12-13 01:42:42 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2020-12-13 01:42:42 +0100 |
commit | b1e14c8893656a01b62a4967cb6102ce3e9015b6 (patch) | |
tree | c8945c7170048eeb23d497f489bdea3e0c8eed02 | |
parent | bfa1b3a0783c6f56996c23bc6662ef597c405057 (diff) | |
download | typ-b1e14c8893656a01b62a4967cb6102ce3e9015b6.tar.gz |
Add 'avg' tool
avg calculates averages for multiple typ results stored in separate files.
-rwxr-xr-x | avg | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -0,0 +1,15 @@ +#!/bin/sh + +# avg -- print averages for multiple typ result files + +awk ' + { + v[FNR] += $1 + $1 = "" + sub(/^ /, "", $0) + t[FNR] = $0 + } + END { + for (i = 1; i<=5; i++) + printf("%.4f\t%s\n", v[i] / (ARGC-1), t[i]) + }' "$@" |