[Toybox] grep corner cases

Isaac ibid.ag at gmail.com
Thu Aug 22 20:09:51 PDT 2013


On Thu, Aug 22, 2013 at 03:38:30AM -0500, Rob Landley wrote:
> On 08/21/2013 03:42:29 PM, Felix Janda wrote:
> >Rob Landley wrote:
> >> > > Does it invert the set of matched _lines_, or does it invert the
> >> > match
> >> > > criteria? I made it so that:
> >> >
> >> >      -v
> >> >      Select lines not matching any of the specified patterns.
> >If the
> >> >      -v option is not specified, selected lines shall be those
> >that
> >> >      match any of the specified patterns.
> >> >
> >> > Does sound to me like the former. This fits the line based
> >nature of
> >> > many
> >> > of the POSIX tools. It however doesn't make grep -vo very useful.

It isn't useful. It isn't predictable (witness this discussion).
In that case, I think gnu actually did something sane: do nothing.
gnu grep -vo is functionally equivalent to "true", except it needs an EOF.


> >>
> >> Posix does not have the -o option. The -o option is not line based.
> >> This is about the effect of other options on the -o option.
> >
> >Since you still can't match things spanning lines -o doesn't seem to
> >make grep into a byte based tool.
> 
> I was thinking more along the lines of "sed exists" if you want to
> do fancy stuff. (Neither is a byte based tool, both are line based.)
> 

> >> > example busybox grep also doesn't output anything.
> >>
> >> What other implementations? -o is a gnu/dammit extension.
> >
> >Did you read the last paragraph you are quoting carefully?
> 
> I did, but busybox has a strong tendency to just "do whatever gnu
> did". Even when what gnu did doesn't make any sense.
> 
> (The answer was "openbsd". I should try again setting up a test
> environment, but _dude_. Those guys are not good at dealing with
> newbies. Oh well, at least some of them are trying...)

netbsd is actually practical to set up, even if the setup interface is 
ancient and you have to be a wizard to dual-boot.
Needs 64 MB to install now, 32 MB for 5.x.

openbsd is explicitly written for the developers, not the users.

> >Just FYI: obase doesn't contain grep.
> 
> Posix does.
> 
> (Which one was obase again? Not in my toybox roadmap, any relation
> to sbase?)

obase is OpenBSD CLI ported to Linux.
But it's not completely ported.
See:
https://github.com/chneukirchen/obase

HTH,
Isaac Dunham

 1377227391.0


More information about the Toybox mailing list