GNU bug report logs - #37607
How to use Grep with Using -o

Previous Next

Package: grep;

Reported by: Matt Zand <mahdiumd <at> gmail.com>

Date: Thu, 3 Oct 2019 16:09:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Matt Zand <mahdiumd <at> gmail.com>, 37607 <at> debbugs.gnu.org
Subject: bug#37607: How to use Grep with Using -o
Date: Thu, 2 Jan 2020 02:00:41 -0800
On 10/3/19 8:54 AM, Matt Zand wrote:

> Is it possible to output symbols which constitute non-matched parts of
> text? For instance, I expect
> 
> printf "banana\napple" | grep --invert-match --only-matching 'ban'
> 
> to produce
> 
> ana
> apple
> 
> or
> 
> apple
> 
> , but it doesn't produce anything.

Unfortunately the -v and -o options don't currently combine in that way. Perhaps
they should, or perhaps another option could be added to do what you want. I'll
mark this as a wishlist item.




This bug report was last modified 4 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.