buggrep - Bugs: bug #25765, grep -P regexp also prints the...

 
 

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

bug #25765: grep -P regexp also prints the line before the match

Submitted by:  Andriy Sen <apsen>
Submitted on:  Wed 04 Mar 2009 07:01:05 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 04 Dec 2009 07:28:08 PM UTC, comment #2:

Duplicate of bug 17264.

Paolo Bonzini <bonzini>
Fri 04 Dec 2009 07:09:46 PM UTC, comment #1:

Reproducible, matches can span multiple lines:

$ echo $'a\nb' | ./grep -P '^(|.*[^0])b'
a
b
$ echo $'a\nb' | ./grep -cP '^(|.*[^0])b'
1

Paolo Bonzini <bonzini>
Wed 04 Mar 2009 07:01:05 PM UTC, original submission:

As far as I could see this is not the same as one of previously reported problems.

See tree examples below. The last one shows the problem.

G:\>grep -V
GNU grep 2.5.3

Copyright (C) 1988, 1992-2002, 2004, 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

G:\>cat test.s
a
1

G:\>od -a test.s

              1. a nl 1 nl

0000004

G:\>cat test.s | grep -P "^[^0]1"

G:\>cat test.s | grep -P "^(|[^0])1"
1

G:\>cat test.s | grep -P "^(|.*[^0])1"
a
1

G:\>

Andriy Sen <apsen>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bonzini (Posted a comment)
  • -unavailable- added by apsen (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to 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:28:08 PM UTCbonziniOpen/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1