I think grep does not have file filtering. To accomplish what you are trying to do, you can combine the find, xargs, and grep commands. My memory is not very good, so the example may not work:
find -name "foo" | xargs grep "pattern"
Find is flexible; you can use wildcards, ignore case, or use regular expressions. You can read the manuals for a full description.
after reading the next post, obviously grep has file name filtering.
Anycorn
source share