NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/43896 (grep -o match problem)
The following reply was made to PR bin/43896; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/43896 (grep -o match problem)
Date: Mon, 27 Sep 2010 08:37:00 +0000
On Mon, Sep 27, 2010 at 08:29:54AM +0000, dholland%NetBSD.org@localhost wrote:
> A bug does exist here, however. grep -o apparently prints each distinct
> match for a given input line separately:
>
> [...]
>
> Reportedly, updating grep will fix the problem.
As does this patch:
Index: src/grep.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/grep/src/grep.c,v
retrieving revision 1.12
diff -u -p -r1.12 grep.c
--- src/grep.c 28 Aug 2008 03:59:06 -0000 1.12
+++ src/grep.c 27 Sep 2010 08:35:31 -0000
@@ -542,7 +542,10 @@ prline (char const *beg, char const *lim
if (b == lim)
break;
if (match_size == 0)
- break;
+ {
+ beg++;
+ continue;
+ }
if(color_option)
printf("\33[%sm", grep_color);
fwrite(b, sizeof (char), match_size, stdout);
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index