git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Joe Perches <joe@perches.com>
Cc: git <git@vger.kernel.org>, Taylor Blau <me@ttaylorr.com>
Subject: Re: request: add git grep -o option
Date: Wed, 30 Oct 2019 16:17:57 -0400	[thread overview]
Message-ID: <20191030201757.GA29013@sigill.intra.peff.net> (raw)
In-Reply-To: <277ee7531df8dfd3249f189b9b298a5d187ec479.camel@perches.com>

On Wed, Oct 30, 2019 at 12:58:59PM -0700, Joe Perches wrote:

> Instead of duplicating a grep pattern with grep -oh after
> git grep like
> this:
> 
> $ git grep -P '(?:[a-z0-9_]+_)?for_each(?:_[a-z0-9_]+)?' -- '*.[ch]' | \
>   grep -P -oh '(?:[a-z0-9_]+_)?for_each(?:_[a-z0-9_]+)?'
> 
> it could be useful to have git grep have the same '-o' option 
> as gnu grep.

Doesn't it already?

  $ git grep -P -oh '(?:[a-z0-9_]+_)?for_each(?:_[a-z0-9_]+)?'
  for_each
  for_each
  for_each_abbrev
  for_each_builtin
  for_each_string_list_item
  for_each_ut
  [etc...]

It was new in Git v2.19.

-Peff

  reply	other threads:[~2019-10-30 20:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 19:58 request: add git grep -o option Joe Perches
2019-10-30 20:17 ` Jeff King [this message]
2019-10-30 20:27   ` Joe Perches

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=20191030201757.GA29013@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=joe@perches.com \
    --cc=me@ttaylorr.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).