[Toybox] grep -vo

enh enh at google.com
Wed Jul 20 08:31:41 PDT 2016


On Wed, Jul 20, 2016 at 12:10 AM, Rob Landley <rob at landley.net> wrote:
> So grep --color requires surprisingly intrusive changes,

that's why i left it to you :-)

> and while I'm
> ripping that a new one I noticed some small bugs (context lines don't
> output -b data, and should), and then there's -o -v.
>
> Ubuntu's grep doesn't implement -ov (it outputs nothing when you select
> those together), but if you do "toybox grep -ov toybox README" in the
> toybox source you get plenty of output... but I'm not happy with it.
>
> In -o -v mode I'm outputting all the line segments that DIDN'T match,
> but I'm splitting lines where a match was removed. That's the logical
> inverse of the -o behavior, which gives each matching line segment on
> its own line, but it seems like -ov is more USEFUL if it just removes
> the matching data, which implies "ooh, it should be able to REPLACE it
> with something", and then there's the "sed already has a thing for this".
>
> But then grep is basically sed -n '/pattern/p' anyway, isn't it?
>
> Dunno the right thing to do here, thought I'd ask on the list. Posix is,
> as usual, no help whatsoever. Neither is LSB.
>
> Should I split the lines or not split the lines?

given that no one seems to have noticed that GNU grep outputs nothing,
how about just "[!ov]" until someone comes along with a convincing
argument/use case?

> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.



More information about the Toybox mailing list