I have a structure where one folder contains many subfolders that each have some .txt documents in it. I'm looking for a way to find the average text lengths (in words). Therefore I want to count the words in each .txt file using wc.
I've tried so far:
ls */*.txt | wc -w (which sadly outputs only a single number).
My other attempt was using
for docs in /home/.../myfolder/*.txt do wc -w docs;
Which just cancels itself after some time.