I'm trying to recursively grep all of the .txt files within a directory:
grep -r --include \*.txt findThisStr .
Unfortunately, the .txt files I'm trying to search have some null characters in them and using the -a or --text flags seems to be causing matches on all the lines in the file. To remedy this, I was hoping to sanitize the input and pipe it through grep (like this), but I'm unsure how to do this recursively, or even if it's possible.
Essentially, I'd like to do something like this, except file would be dynamic:
cat file | tr -d '\000' | grep -r --include \*.txt findThisStr .
I'm using grep on Windows 7 through the 64-bit MINGW shell.