I want to recursively find files in my source tree by contents. I've tried the following using grep:
$ grep -rn printf | grep %s | grep bcm_errmsg\(rv\)
This returns me every line as I wanted but now, I would like to get the filename of each file that matches, so I changed it to:
$ grep -rn printf | grep %s | grep -l bcm_errmsg\(rv\)
but instead of printing the filenames, I only get
printed to stdout. How do I fix this to get each filename & path (to use
sed on it)?
What I want to do: Find every file with
printf lines that also contain
bcm_errmsg(rv) and then apply the following sed command to the files found:
sed -i 's/%s/%d/g; s/bcm_errmsg(rv)/rv/g;'