aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-12-13 01:53:48 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-12-13 01:54:19 +0100
commitda7ec287a7e9930794667d274582f0893602712d (patch)
tree4a9620a5c3c92d7467945766e405e3d4f199cec8
parentb1e14c8893656a01b62a4967cb6102ce3e9015b6 (diff)
downloadtyp-da7ec287a7e9930794667d274582f0893602712d.tar.gz
Add 'dif' toolHEADmaster
dif calculates the difference between two avg results stored in separate files.
-rwxr-xr-xdif14
1 files changed, 14 insertions, 0 deletions
diff --git a/dif b/dif
new file mode 100755
index 0000000..4d34823
--- /dev/null
+++ b/dif
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# dif -- print differences between two typ result files
+
+awk -vn=`wc -l "$1" | cut -d\ -f1` '
+ NR <= n {
+ v[FNR] += $1
+ $1 = ""
+ sub(/^ /, "", $0)
+ t[FNR] = $0
+ }
+ NR > n {
+ printf("%.4f\t%s\n", v[FNR] - $1, t[FNR])
+ }' "$1" "$2"