Ubuntu – Find all files with specific extensions that contains a string

command linefilesfind

I'd like to know how could I find all files whose extension can be .xml and .py that contain the string "Jason" under a path "./" recursively?

Or how could I exclude .po from the search?

Best Answer

You can do it with grep only (without using find):

grep --include=\*.{xml,py} -Rl ./ -e "Jason"

And to exclude .po:

grep --exclude=*.po --include=\*.{xml,py} -Rl ./ -e "Jason"