Menu

#2 Allow -v to function for multi-line patterns  Edit

None
closed
None
2016-03-03
2016-01-26
Anonymous
No

This made me sad since this was exactly what I wanted to use it for.

mgrep: -v is allowed for single-line patterns only.

Discussion

  • Peter Istvan Lenard

    It would raise some questions. Eg. grep -vc apple input.txt counts the number of lines not containing "apple". If we extend this functionality for multiline patterns, what should mgrep -vc 'apple.*$^.*plum' input.txt give back? This is not really definite, since the number of non-matching multiline blocks is the number of many different-length blocks...

    Maybe it is meaningful if disabled in conjunction with -c but I would still need to think over its interaction with the other options.

    What would you like to use this option for exactly? To filter out multiline blocks from an input? Eg. mgrep -v 'apple.*$^.*plum' input.txt to get rid of all two-line blocks having "apple" in the first line and "plum" in the second?

     
  • Peter Istvan Lenard

    Implemented in v1.1.1.

    -v is not allowed together with -c. All else should be possible.

     
  • Peter Istvan Lenard

    • status: open --> accepted
    • assigned_to: Peter Istvan Lenard
    • Milestone: -->
     
  • Peter Istvan Lenard

    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB