On 9/27/23 21:40, Jamie Landeg-Jones wrote:
When using color=always and a regex of '.' (for example), output lines
are duplicated.

$ grep --version
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

E.G.:

$ grep --color=always . /etc/fstab

Cheers, Jamie


I think this is what we want:

https://people.freebsd.org/~kevans/grep-color.diff

Basically, for --color with . we actually get each individual character reported, and we can't really coalesce that. (Well, we could, but I'll leave that for future improvement). Once you hit 32 matches in the same line, we dump out the first set of matches then check again for any more that just didn't fit the first time. Unfortunately, that logic wasn't prepared to avoid terminating the first time in case we have more matches to output, so we'd terminate, then refill our matches with the remainder of the line and output the leading context again + terminate again.

Thanks,

Kyle Evans

Reply via email to