* How to supply "raw" bytes to git grep?
@ 2008-09-18 15:28 Johan Herland
2008-09-18 15:46 ` Jacob Helwig
2008-09-18 16:31 ` Jakub Narebski
0 siblings, 2 replies; 5+ messages in thread
From: Johan Herland @ 2008-09-18 15:28 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to supply "raw" bytes to git grep?
2008-09-18 15:28 How to supply "raw" bytes to git grep? Johan Herland
@ 2008-09-18 15:46 ` Jacob Helwig
2008-09-18 16:18 ` Johan Herland
2008-09-18 22:07 ` Kalle Olavi Niemitalo
2008-09-18 16:31 ` Jakub Narebski
1 sibling, 2 replies; 5+ messages in thread
From: Jacob Helwig @ 2008-09-18 15:46 UTC (permalink / raw)
To: Johan Herland; +Cc: git
On Thu, Sep 18, 2008 at 08:28, Johan Herland <johan@herland.net> wrote:
> 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>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to supply "raw" bytes to git grep?
2008-09-18 15:46 ` Jacob Helwig
@ 2008-09-18 16:18 ` Johan Herland
2008-09-18 22:07 ` Kalle Olavi Niemitalo
1 sibling, 0 replies; 5+ messages in thread
From: Johan Herland @ 2008-09-18 16:18 UTC (permalink / raw)
To: Jacob Helwig; +Cc: git
On Thursday 18 September 2008, Jacob Helwig wrote:
> On Thu, Sep 18, 2008 at 08:28, Johan Herland wrote:
> > 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...
>
> Inserting a literal carriage return seems to do the trick for me, in
> bash.
>
> git grep --cached -I -l -e <Ctrl-V><Ctrl-M>
Thanks. That's exactly the incantation I was looking for. ;)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to supply "raw" bytes to git grep?
2008-09-18 15:28 How to supply "raw" bytes to git grep? Johan Herland
2008-09-18 15:46 ` Jacob Helwig
@ 2008-09-18 16:31 ` Jakub Narebski
1 sibling, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2008-09-18 16:31 UTC (permalink / raw)
To: git
Johan Herland wrote:
> 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...
Why not use _literal_ CR; of course protecting it by piockung it by
shell as end of command by quites, for example
$ git grep --cached -I -l -e '
'
It works for me (bash).
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to supply "raw" bytes to git grep?
2008-09-18 15:46 ` Jacob Helwig
2008-09-18 16:18 ` Johan Herland
@ 2008-09-18 22:07 ` Kalle Olavi Niemitalo
1 sibling, 0 replies; 5+ messages in thread
From: Kalle Olavi Niemitalo @ 2008-09-18 22:07 UTC (permalink / raw)
To: git
"Jacob Helwig" <jacob.helwig@gmail.com> writes:
> Inserting a literal carriage return seems to do the trick for me, in bash.
>
> git grep --cached -I -l -e <Ctrl-V><Ctrl-M>
In bash, $'\r' works too, and may be nicer to edit.
Better not use that with #! /bin/sh though.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-09-18 22:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 15:28 How to supply "raw" bytes to git grep? Johan Herland
2008-09-18 15:46 ` Jacob Helwig
2008-09-18 16:18 ` Johan Herland
2008-09-18 22:07 ` Kalle Olavi Niemitalo
2008-09-18 16:31 ` Jakub Narebski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).