I am struggling with the following issue. I have a Unix directory containing ~ 60K files and I would like to be able to count all the words in each file and output a list with each count along with its corresponding filename.
Counting all words in multiple files and outputting each count along with its filename
9k Views Asked by panza At
2
This is a job for
findandwc:This will
findall files (-type f) in the current working directory (.), without recursing into subdirectories (-maxdepth 1) and for each result will execute (-exec [...] \;)wc -wpassing that filename ({}) as an argument.wcprints the number of newlines, words, and bytes in files by default,-wspecifies it should just print the word-count.