Bug 447537

Summary: grep -P matches across multiple lines
Product: Red Hat Enterprise Linux 5 Reporter: Petr Šplíchal <psplicha>
Component: grepAssignee: Stepan Kasal <kasal>
Status: CLOSED DEFERRED QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.3CC: ohudlick
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-18 16:01:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Šplíchal 2008-05-20 13:31:22 UTC
When interpreting supplied pattern as perl regular expression grep displays
match across multiple lines --- in spite of the ^beginning-of-line character
specified in the pattern.

Actual result:
$ echo -e "\n\n\n   foo" | grep -P '^\s*foo'



   foo

Expected result:
The leading empty lines should be omitted from the output:

$ echo -e "\n\n\n   foo" | grep -P '^\s*foo'
   foo

Comment 1 Stepan Kasal 2008-07-18 16:01:54 UTC
Unfortunately, the -P option of GNU grep is still only an experimental feature
in the upstream source.