[CentOS] recursively count the words occurrence in the text files
Stephen Harris
lists at spuddy.org
Thu Dec 30 18:56:49 UTC 2010
On Thu, Dec 30, 2010 at 10:34:58AM -0800, S Mathias wrote:
> I just can't google for it:
I'm a little concerned about the number of "schoolbook" questions showing
on this list, recently. However...
> echo "word1 word2 word3" > one/asf.txt
> echo "word2 word4, word5" > one/asfcxv saf.txt
Yeah, that line won't work like you think.
> $ SOMEMAGIC > output.txt
I'd do something like
cat */* | tr -c '[:alpha:]' '\012' | grep -v '^$' | sort | uniq -c
If more than just one layer of subdirs, replace the "cat */*" with
find . -type f -exec cat {} \;
--
rgds
Stephen
More information about the CentOS
mailing list