I need an egrep command that list all the file names that contains the words + which string it has found. Let's imagine this scenario:
Words that I need to find:
What I need: I want to list all files that contains any of them (don't need to have all of them in the same file), and print which word it found in the file. Example of a search result I want:
I remember seeing a
grep command which shows
FILENAME:STRING in the search results, but I can't remember how it was done. I tried:
egrep -lr 'apple|banana|watermelon' .
But the search results showed:
Ok, it helps but ... in
file1, which one of the words it found? That's the problem I'm facing .