git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git grep -a doesn't find string in binary file

From
Phil Lawrence <prlawrence@gmail.com>
Date
Mar 23, 2010, 22:06 UTC
Message-ID
<530ac78e1003231506x295080cey858a5f393548cc53@mail.gmail.com>
I have a binary file with the string 'SEGMENT4' inside:
    $ strings AR/reports/BMCD_AGED_AR_CUST.rdf | grep -i segment4
    (CC.SEGMENT1 || '\n' || SEGMENT2 || '\n' || SEGMENT3 || '\n' || SEGMENT4 ...
grep sees it:
    $ grep -li segment4 AR/reports/BMCD_AGED_AR_CUST.rdf | wc -l
          1
git grep does not:
    $ git grep -a -li segment4 AR/reports/BMCD_AGED_AR_CUST.rdf | wc -l
          0
What am I missing?
Here is my environment info:
    $ uname -a
    MINGW32_NT-5.1 B8058 1.0.12(0.46/3/2) 2010-02-05 01:08 i686 unknown
    $ git --version
    git version 1.7.0.2.msysgit.0

Thank you, Phil Lawrence

Message 1 of 1 in “git grep -a doesn't find string in binary file”
  1. Phil LawrenceMar 23, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.