[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: anyone have software to OCR a PDF?
David Wilson wrote:
> On Feb 13, 9:54 am, David Wilson <mcs6...@gmail.com> wrote:
>> #!/bin/sh
>> tr -c '[:alnum:]' '[\n*62]' | sort | uniq -c | sort -n
>>
>> Hmm - how did those 3 pipes get through the tr?
>
> The reason is that string2 is too short. In the C locale :alnum: is 62
> characters but the complement of :alnum: is more like 256-62=194
> characters. Replace the 62 with 194 (or even 256) and it works
> properly.
And you can get rid of the "spurious" number (the number of newlines) by
adding an egrep -v to the mix:
tr -c '[:alnum:]' '[\n*194]' | egrep -v '^$' | sort | uniq -c | sort -n
On itself:
1 194
1 alnum
1 bin
1 egrep
1 sh
1 tr
1 uniq
1 v
2 c
2 n
2 sort
--
-- Jerry