#! /bin/sh
# Read a text stream on standard input, and output a list of
# the n (default: 25) most frequently occurring words and
# their frequency count, in order of descending counts, on
# standard output.
#
# Usage:
# wf [n]
tr -cs A-Za-z\' '\n' |
tr A-Z a-z |
sort |
uniq -c |
sort -k1,1nr -k2 |
sed ${1:-25}q
./wf 10 < testdoc
4 a
4 i
4 the
3 queue
3 to
2 am
2 global
2 is
2 within
1 and
you have done better than needed.
e.g.
"white dog may or may not run fast.
It may rain today."
here "may" comes twice in same line and once in other line. I just want to find out how many counts of "may" are.