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

Submitter:  Ed Avis <epaepa>
Submitted:  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

  Spam posted by _339726
Fri 04 Dec 2009 07:56:51 PM UTC, comment #2: 

Duplicate of 22100.

Paolo Bonzini <bonzini>
  Spam posted by #66134
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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 _339726 (Posted a comment)
  • -email is unavailable- added by bonzini (Posted a comment)
  • -email is unavailable- added by #66134 (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-04 bonzini Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code