Richard Neill <rn214 <at> hermes.cam.ac.uk> writes:

[report lines matching all of several patterns]

>But seriously, I still think this would be worth adding to grep if 
>possible. My thoughts:
>    - awk is relatively arcane, whereas lots of people know grep.
>    - grep does almost everything needed, so why have yet another tool
>    - awk isn't always available.
> 
>Also, it is related to bug 15280  https://savannah.gnu.org/bugs/?15280

Thanks for spotting that!  I was about to mention it.

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]'

or whatever syntax is preferred.

Of course, the mere fact that something is not easily possible in awk is not
sufficient reason for it to be in grep - awk has no built-in mail client, either
- but searching for two patterns which must both match is a pretty common
operation and would seem to be within grep's remit.

-- 
Ed Avis <[EMAIL PROTECTED]>




Reply via email to