diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-11 00:09:24 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-11 00:09:24 +1300 |
commit | 960208a496240318b38a6a6cfdf1f5e266099c85 (patch) | |
tree | de7ff197a3514d3e0bcfa6acbfa748b2738c5692 /bin/med.awk | |
parent | Remove superfluous calls to next in sec(1df) (diff) | |
download | dotfiles-960208a496240318b38a6a6cfdf1f5e266099c85.tar.gz dotfiles-960208a496240318b38a6a6cfdf1f5e266099c85.zip |
Stylistic tweaks to awk scripts
Diffstat (limited to 'bin/med.awk')
-rw-r--r-- | bin/med.awk | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bin/med.awk b/bin/med.awk index 83f0eb74..8167f8dd 100644 --- a/bin/med.awk +++ b/bin/med.awk @@ -7,11 +7,10 @@ END { # Error out if we read no values at all if (!NR) exit(1) - if (NR % 2) { + if (NR % 2) med = vals[(NR+1)/2] - } else { + else med = (vals[NR/2] + vals[NR/2+1]) / 2 - } print med if (warn) exit(1) |