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

Re: How to supply "raw" bytes to git grep?

From
Jacob Helwig <jacob.helwig@gmail.com>
Date
Sep 18, 2008, 15:46 UTC
Message-ID
<8c9a060809180846j25e4eb44h291b017aa01bbe36@mail.gmail.com>
In-Reply-To
<200809181728.18597.johan@herland.net>
On Thu, Sep 18, 2008 at 08:28, Johan Herland <johan@herland.net> wrote:
Show 33 quoted lines
> Hi,
>
> I wanted to list all text files in my repo which contain carriage
> returns, so I tried the following command-line:
>
>        git grep --cached -I -l -e <CR>
>
> where <CR> is some magic incantation that I've yet to figure out. I've
> tried all the obvious cases (\r, 0x0d, \015, etc.), but none of them
> seem to DWIM...
>
> The only working solution I've found so far is to create a file
> (named "cr") in a hex editor that contains exactly one CR byte, and
> then use the -f option to 'git grep':
>
>        git grep --cached -I -l -f cr
>
> Is there an easier way? And if not, should I try to create one (e.g.
> teaching 'git grep' to grok backslash escapes)?
>
>
> Have fun!
>
> ...Johan
>
> --
> Johan Herland, <johan@herland.net>
> www.herland.net
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Inserting a literal carriage return seems to do the trick for me, in bash.
git grep --cached -I -l -e <Ctrl-V><Ctrl-M>
Previous: Johan HerlandNext: Johan Herland
Message 2 of 5 in “How to supply "raw" bytes to git grep?”
  1. Johan HerlandSep 18, 2008
  2. Jacob HelwigSep 18, 2008
  3. Johan HerlandSep 18, 2008
  4. Kalle Olavi NiemitaloSep 18, 2008
  5. Jakub NarebskiSep 18, 2008

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.