Skip to main content

Add my tally script

ID
0bdb224
date
2022-03-20 20:36:41+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
23d991a
message
Add my tally script
changed files
1 file, 19 additions

Changed files

tally (0) → tally (406)

diff --git a/tally b/tally
new file mode 100755
index 0000000..2d03eef
--- /dev/null
+++ b/tally
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+# This is a quick alias for tallying values -- given a list of values,
+# this prints a table of the values in ascending order.
+#
+# e.g. to find the third character of words that start with 'a':
+#
+#     $ grep '^a' /usr/share/dict/words | cut -c 3 | tally
+#     ...
+#      955 c
+#      975 r
+#     1066 o
+#     1191 a
+#     3226 t
+#
+
+set -o errexit
+set -o nounset
+
+sort | uniq -c | sort