aboutsummaryrefslogtreecommitdiff
path: root/bin/max.awk
diff options
context:
space:
mode:
Diffstat (limited to 'bin/max.awk')
-rw-r--r--bin/max.awk10
1 files changed, 10 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
+}