bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep problem with -o and line anchors/


From: Nis Jorgensen
Subject: grep problem with -o and line anchors/
Date: Thu, 23 Jun 2005 11:24:16 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hello gnu hackers

I am seeing a problem when trying to extract the matching string and
anchoring to the beginning of the string. Using 2.5.1 on Redhat EL4

address@hidden log]$ echo 'abac' | grep -o  '^a.'
ab
ac

This should, IMO, only return "ab", since ac does not match at the
beginning of the link.

Also, if -o is supposed to return multiple occurrences from the same
line, I believe this should be documented. For instance:

-o, --only-matching
        Show only the part of a matching line that matches PATTERN. If multiple
non-overlapping matches are found in the same line, a match is reported
for each.

I believe that this functionality should be disabled by default, but
would be a very nice option.

-- 
Nis Jorgensen
Greenpeace International IT dept.
+31 20 718 2087

The arc of the moral universe is long, but it bends toward justice.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]