grep -rl "string" /path
find . -name "*.jar" | xargs grep Topic
locate try.txt | xargs grep hello
The methods serve different purposes.
recursive search and replace old with new string, inside files
$ grep -rl oldstring . |xargs sed -i -e 's/oldstring/newstring/'
find . -type f -name "*.css"
Let’s find all CSS files that do something with your HTML ID #content next
find . -name "*.css" -exec grep -l "#content" {} \;
# find files changed in the last 1 day
find . -mtime -1 -type f
# find CSS files, omitting results containing “CVS”
find . \! -path "*CVS*" -type f -name "*.css"
# find files newer than main.css in ~/src
find ~/src -newer main.css
# combine with xargs for more power than -exec
find . -name \*.css -print0 | xargs -0 grep -nH foo