bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #22100] Enhancement request:


From: Tony Abou-Assaleh
Subject: Re: [bug #22100] Enhancement request:
Date: Tue, 12 Feb 2008 01:55:38 -0400 (AST)

> IMHO, context matching is a good reason why it is more powerful (and not just
> syntactic icing or making the search faster) to support matching two patterns 
> at
> once.  I don't think there is a straightforward awk equivalent, or 
> grep-pipeline
> equivalent, to
>
> % grep -E --context=10 oranges --and '[0-9]'

You can do this both in grep (using -z) and in awk (by changing the
record separator) and then matching for \n the desired number of times.

The and operator can be done as follows:

grep -E '(re1.*re2)|(re2.*re1)'

In terms of "power", grep regexp can do a lot. Sure it gets complicated,
but the usage is less common, and for the rare cases it can be done.

I haven't formally tested this in grep (only in Perl), but I think
chaining grep expressions is faster in most cases than using a single
complex expression.

Making grep do more with less is on my radar, but it is not a priority at
the moment. There are some serious bugs that need to be fixed first.

Cheers,

TAA

-- 
Tony Abou-Assaleh
Email:    address@hidden
Web site: http://tony.abou-assaleh.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]