[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: anyone have software to OCR a PDF?



On Feb 12, 10:16 am, "Michael J. Mahon" <mjma...@aol.com> wrote:
> In Unix it's a "wordcount" program--it's been too long
> for me to remember the command name...  ;-(

I just knocked up a script on UNIX (Solaris 10) to give a frequency
table of all the "words" in a file:

#!/bin/sh
tr -c '[:alnum:]' '[\n*62]' | sort | uniq -c | sort -n

This treats any sequence of letters and numbers as a word and gives a
list of words in ascending order of frequency.
It does end with a spurious number at the end but it looks good enough
for this job. When run on itself I get:

1 62
1 alnum
1 bin
1 sh
1 tr
1 uniq
2 c
2 n
3 |
17

Hmm - how did those 3 pipes get through the tr?