buggrep - Bugs: bug #15280, Feature request: better support...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #15280: Feature request: better support for multiple patterns

Submitted by:  Ed Avis <epaepa>
Submitted on:  Fri 23 Dec 2005 11:01:56 AM UTC  
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Fri 04 Dec 2009 07:56:51 PM UTC, comment #1:

Duplicate of 22100.

Paolo Bonzini <bonzini>
Fri 23 Dec 2005 11:01:56 AM UTC, original submission:

Grep lets you specify more than one pattern using multiple -e options. Then a line matches if any of the patterns match. Effectively each -e means 'or'.

It would be useful to have -and and -not options a la find(1), so

% grep -e hello -and -e there

to match lines containing both words. This simple example could be done with two grep processes in a pipeline, but it's certainly faster to grep the file once, and once you start adding context:

% grep --context=10 -e hello -and -e there

it's not really possible to get the same search with two separate greps.

The -v flag negates the sense of matching but it applies globally. You cannot ask grep to print lines matching one pattern but not another. As far as I know, grep's regular expressions don't have a negation operator so this would be an increase in grep's power. And handy together with -and, for example

% grep --context=10 -e '\*\*\*' -and -not -e 'modification time'

as a way to search your build logs for make errors which aren't the common 'modification time in the future'.

Ed Avis <epaepa>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bonzini (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    Fri 04 Dec 2009 07:56:51 PM UTC bonzini Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.3