Bug 144980 - Bug in special character ^ matching with -o and -c
Summary: Bug in special character ^ matching with -o and -c
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: grep
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-01-13 11:33 UTC by E. Choroba
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-01-13 12:10:02 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description E. Choroba 2005-01-13 11:33:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20041020

Description of problem:
Grep does not recognise beginning of a line when using the "matching
part" switches. If the line really matches the given pattern, then
grep tries to match the pattern in the line with the last match
deleted (try the following line: 
 $ echo aa | grep -o ^a
Expected result is
 a
while grep gives
 a
 a
which is a bug. Similarly,
 $ echo ab | grep -o ^.
should return
 a
but returns
 a
 b


Version-Release number of selected component (if applicable):
grep-2.5.1-31.2

How reproducible:
Always

Steps to Reproduce:
1. Run grep -c or grep -o. Use the special character ^ in the regular
expression.
2. If there is a matching line that contains the pattern more than
once with no other characters between the matches, all the matches are
written out.

Additional info:

Comment 1 Tim Waugh 2005-01-13 11:52:23 UTC
This happens with pristine 2.5.1a as well.

Comment 2 Tim Waugh 2005-01-13 12:10:02 UTC
Reported upstream:
https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=11579


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