aboutsummaryrefslogtreecommitdiff
path: root/bin/med.awk
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-11 00:09:24 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-11 00:09:24 +1300
commit960208a496240318b38a6a6cfdf1f5e266099c85 (patch)
treede7ff197a3514d3e0bcfa6acbfa748b2738c5692 /bin/med.awk
parentRemove superfluous calls to next in sec(1df) (diff)
downloaddotfiles-960208a496240318b38a6a6cfdf1f5e266099c85.tar.gz
dotfiles-960208a496240318b38a6a6cfdf1f5e266099c85.zip
Stylistic tweaks to awk scripts
Diffstat (limited to 'bin/med.awk')
-rw-r--r--bin/med.awk5
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)