You want to use find for this, since grep will not work as recursively (as far as I know). Something like this should work:
find . -name "strings.xml" -exec grep "text" "{}" \;
The find searches the current directory ( . ) For a file named strings.xml ( -name "strings.xml" ), and then runs the specified grep for each file found. Curly braces ( "{}" ) are placeholders that find uses to indicate the name of a found file. More information can be found in man find .
Also note that the -r option for grep is no longer needed, since find works recursively.
source share