Some basic word counting on text files in bash, I was tokenizing to one token per line and then counting:
tr -cs '[:alnum:]' '[\n*]' | sort | uniq -c
The sort takes a long time (probably just n log n I guess) on a big text. Swapping for
awk '{k[$0]++} END {for (token in k) print token, k[token];}'
and then sorting on the numbers does the same thing faster.