Reputation: 57
I have a bunch of files named xaa, xab, xac,..., xtf. I need to return the count of words in each of these fies.
I currently have:
grep -o ' ' x* | wc -l
but this just gives me 1's when there are several words...
(I posted something like this already... I am trying to explain in a clearer manner what I am having trouble with.)
Upvotes: 0
Views: 83
Reputation: 369394
-l
option of wc
make it to print line count. To get word count, use -w
option.
grep -o ..
prints only the matched parts. Use cat
instead:
cat x* | wc -w
UPDATE according to the comment:
wc -w x*
Upvotes: 1