There is a similar question to mine already but mine has a slight difference. I want to see how many files contain each word. When a file has a word then it increments the counter and then continues to the next file. I do not want to know how many times the word appears in each file or the name of the file it appears in, just a counter saying how many files the word is found in my files. For example: I have a directory with 10 files, each file is a recipe and i want to see how many files contain the word 'salt'. After running the command it would output something like : 9 Salt. Meaning it was found in 9 out of 10 files. I want this for everyword though. So far I have this:
grep -l *| tr '[A-Z]' '[a-z]' | tr -d '[:punct:]' | tr ' ' '\n' | sort | uniq | wc -l
Any help is much appreciated.