git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: "Torne (Richard Coles)" <torne@google.com>
Cc: git@vger.kernel.org
Subject: Re: git grep -F doesn't behave like grep -F?
Date: Fri, 18 May 2012 14:37:00 +0200	[thread overview]
Message-ID: <4FB6426C.7040202@lsrfire.ath.cx> (raw)
In-Reply-To: <CAEV-rjc0PtuQZei95_24=Ou=mZZxA0Lsr6boXGrGy3z40otkNQ@mail.gmail.com>

Am 18.05.2012 13:00, schrieb Torne (Richard Coles):
> Hi folks,
>
> git grep -F is documented as: "Use fixed strings for patterns (don’t
> interpret pattern as a regex)."
>
> whereas grep -F is documented as "Interpret PATTERN as a  list  of
> fixed  strings,  separated  by newlines,  any  of  which is to be
> matched."
>
> This accurately describes how they behave, which means that git grep
> -F with a pattern containing newlines never matches anything (at least
> as far as I can see). Is this intentional, or an oversight? The
> ability to grep -F for a list (e.g. the output of another grep) is
> pretty handy...

You could use -f- (read patterns from stdin).

That said, it looks like a missing feature to me -- at least I didn't 
know that grep -F takes newline separated lists of search strings.  And 
this doesn't seem to be restricted to invocations with -F, only; a plain 
grep with regexps does it as well.

René

  reply	other threads:[~2012-05-18 12:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 11:00 git grep -F doesn't behave like grep -F? Torne (Richard Coles)
2012-05-18 12:37 ` René Scharfe [this message]
2012-05-18 12:41   ` Torne (Richard Coles)
2012-05-20 14:32     ` [PATCH 1/3] grep: factor out create_grep_pat() René Scharfe
2012-05-20 14:32     ` [PATCH 2/3] grep: factor out do_append_grep_pat() René Scharfe
2012-05-20 14:33     ` [PATCH 3/3] grep: support newline separated pattern list René Scharfe
2012-05-20 22:29       ` Junio C Hamano
2012-05-21 16:10         ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FB6426C.7040202@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=torne@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).