There is no reason to use find : grep comes with the -r recursive option. To simply get a list of match file names (as opposed to a list of all matching lines in all files), you can use the -l option. If you want to completely ignore all binary files, you can use the --binary-files=without-match option. If you want to ignore files with a specific extension, you can use the --exclude , for example. --exclude=*.{jpg,jpeg} ignore all files ending in .jpg or .jpeg . So you should be able to get what you want:
grep -r -l --binary-files=without-match .
Now you mentioned in one of your comments that your version of grep does not have the -r or -l options. This is unfortunate, and I recommend getting a newer version of grep (preferably a variation of GNU).
One more note: if you use find -exec , you should use + to complete the command instead of a half ring, for example:
find . -exec grep options '{}' '+'
Using + , find will only throw away one process and pass all the corresponding file names as command line arguments to a single grep instance. As long as you don't have a million matching files (which would create a command line much longer than the shell can handle), it will be much faster. If a semicolon is used instead, find creates a new process for each corresponding file, which is very slow for a very large number of files.
source share