Why doesn't grep ignore binary files by default?
Not everything that grep thinks is a binary file, is actually a binary file. e.g. puppet's logs have ansi color coding in them, which makes grep think they're binary. I'd still want to search them if I'm grepping through /var/log though.
grep
’s ability to search binary files is also useful when I’m compiling a program and the linker (ld
) complains about some function not being found.
I can use a command like
grep function_name /lib/lib*
to find the library which contains it. (Libraries are binary files.)