I want to search a bunch of files and list only those containing a minimum number of pattern matches. So if I want to identify files containing 3 (or more) instances of the pattern "said:" and I have file1 that contains the lines:
He said:
She said:
and file2 that contains the lines:
He said:
She said:
We said:
How do I match only file2?
The files that I want to search are in listed in a file called list.txt, I have tried:
cat list.txt | while read LST ; do egrep -m3 -iol " said:" $LST ; done
This obviously fails because I can only (apparently!) match a maximum number of pattern matches with grep.
TIA