How to count the number of words in all directory files? But with the count increased only once per word per file

This question is an additional restriction for this question . I wanted to achieve word count by avoiding multiple counts for the same word in one file? For example: if the word "aaa" appears in "file1.txt" 10 times, but the score should only increase by 1, not 10, etc. For other files, also inside the directory.

+2
linux grep find count word
Nov 08
source share
1 answer

So, you want to specify the number of files containing this word. Easily:

grep -l word *|wc -l 
+5
Nov 08 '13 at
source share
— -



All Articles