[Linux-disciples] Converting an array to a hash
Adam Rosi-Kessel
adam at rosi-kessel.org
Wed Oct 6 13:42:08 EDT 2004
On Wed, Oct 06, 2004 at 01:35:12PM -0400, Stephen R Laniel wrote:
> On Wed, Oct 06, 2004 at 01:31:03PM -0400, Adam Rosi-Kessel wrote:
> > You could, of course, also run the command line:
> >
> > find . -type f -exec cat '{}' ';' | tr " " "\n" | sort | uniq -c | sort -nr
>
> Quite right; I hadn't thought about that, but it's pretty
> cool.
>
> The command line would have to be modified so that we're not
> catching words with numbers, or other such non-English
> words. It would also have to convert everything to lowercase
> so that 'the' doesn't count as a different word from 'The'.
> After all that is said and done, and after appropriate error
> checking, I wonder whether the bash trick would be any
> shorter?
Ah, wouldn't be too much work:
find . -type f -exec cat '{}' ';' | tr "A-Z ,." "a-z\n" | grep -v "[0-9\<\>=\/\"\*]" | sort | uniq -c | sort -nr
Something like that. Might still need a little honing.
--
Adam Rosi-Kessel
http://adam.rosi-kessel.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20041006/50377431/attachment.pgp
More information about the Linux-disciples
mailing list