about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-05-16 21:31:12 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-05-16 21:31:12 +0200
commit17fe13a95feccd83c4900be1f603618d22f980ae (patch)
tree2762bab889a1fab7efd7a527f1fc5097a0660205
parent41a9a6b40d45939cd98e72c76a8c16dabcd84318 (diff)
downloadmblaze-17fe13a95feccd83c4900be1f603618d22f980ae.tar.gz
mblaze-17fe13a95feccd83c4900be1f603618d22f980ae.tar.xz
mblaze-17fe13a95feccd83c4900be1f603618d22f980ae.zip
add contrib/mcount, a tool to count mails (possibly between pipes)
-rwxr-xr-xcontrib/mcount10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/mcount b/contrib/mcount
new file mode 100755
index 0000000..a6d1d5f
--- /dev/null
+++ b/contrib/mcount
@@ -0,0 +1,10 @@
+#!/bin/sh
+# mcount - count mails from sequence on stdin
+
+[ -t 1 ] && stdout=1
+
+awk -v stdout=$stdout '
+  !/^ *</ { n++ }
+  !stdout { print }
+  END { fflush(); print n " mails processed" > "/dev/stderr" }
+'