text/tally
- 442 bytes
- View raw
1#!/usr/bin/env bash
2# This is a quick alias for tallying values -- given a list of values,
3# this prints a table of the values in ascending order.
4#
5# e.g. to find the third character of words that start with 'a':
6#
7# $ grep '^a' /usr/share/dict/words | cut -c 3 | tally
8# ...
9# 955 c
10# 975 r
11# 1066 o
12# 1191 a
13# 3226 t
14#
16set -o errexit
17set -o nounset
19sed 's/\r//g' | sort | uniq --count | sort --numeric-sort