Bug 447537 - grep -P matches across multiple lines
Summary: grep -P matches across multiple lines
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: grep
Version: 5.3
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Stepan Kasal
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-05-20 13:31 UTC by Petr Šplíchal
Modified: 2016-06-01 01:36 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-07-18 16:01:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.