Subject: bug#37607: How to use Grep with Using -o

From: Paul Eggert <[email-masked]>
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.