diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-27 18:00:02 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-27 18:00:02 +1300 |
commit | c4e80884b5c8ee0e2fbabaa867586d29e1ace9ef (patch) | |
tree | 69999e18d91294a2b822b16e2932acacfdb9283a /bin | |
parent | Merge branches 'port/bsd/*' (diff) | |
download | dotfiles-c4e80884b5c8ee0e2fbabaa867586d29e1ace9ef.tar.gz dotfiles-c4e80884b5c8ee0e2fbabaa867586d29e1ace9ef.zip |
Add max(1df) and min(1df)
Diffstat (limited to 'bin')
-rw-r--r-- | bin/max.awk | 10 | ||||
-rw-r--r-- | bin/min.awk | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/bin/max.awk b/bin/max.awk new file mode 100644 index 00000000..11d4efd9 --- /dev/null +++ b/bin/max.awk @@ -0,0 +1,10 @@ +# Get the maximum of a list of numbers +{ + if (NR == 1 || $1 > max) + max = $1 +} +END { + if (!NR) + exit(1) + print max +} diff --git a/bin/min.awk b/bin/min.awk new file mode 100644 index 00000000..c58a3a8f --- /dev/null +++ b/bin/min.awk @@ -0,0 +1,10 @@ +# Get the minimum of a list of numbers +{ + if (NR == 1 || $1 < min) + min = $1 +} +END { + if (!NR) + exit(1) + print min +} |