[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: I think I've asked before, but how do I get rid of the false positives for a binary file in a -r search?



gene heskett wrote: 
> Greetings all;
> 
> I'm looking for the source file in ".scad" format, which it pretty std text,
> of a module name
> that is likely in a file with a different parent filename, using two greps,
> piping  a -r .scad|grep name
> in file, but I'm getting 5000 lines of binary file matches when it doesn't.
> 
> grep -r .scad|grep thrust_brace
> 
> Is there an option to shut that binary trash talk off?

Yes. Here's how I found it:

man grep

/binary

result:

  --binary-files=TYPE
              If a file's data or metadata indicate that the file
              contains binary data, assume that the file is of type
              TYPE. 
...
              If TYPE is without-match, when grep discovers null input
              binary data it assumes that the rest of the file does not
              match; this is equivalent to the -I option.

So -I will help you out.

-dsr-


Reply to: