bug-grep
[Top][All Lists]
Advanced

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

colors too much when pattern is dot


From: Mikel Ward
Subject: colors too much when pattern is dot
Date: Thu, 24 Apr 2008 11:19:05 +1000

With GREP_COLOR enabled, grep --color=auto colors the entire line when
the pattern is "." or "^.".

It's not a big problem, and maybe my understanding is wrong, but I
would expect the . to match only the first character, and hence only
the first character should be colored.

(Colored or highlighted part indicated by underscores)

$ export GREP_COLOR=4

$ grep --version
grep (GNU grep) 2.5.1

Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ echo "foo" | grep --color=auto "f"
_f_oo
$ echo "foo" | grep --color=auto "."
_foo_
$ echo "foo" | grep --color=auto "^."
_foo_

With 2.5.3, it's half fixed.

$ src/grep --version
GNU grep 2.5.3

Copyright (C) 1988, 1992-2002, 2004, 2005  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ echo "foo" | src/grep --color=auto "f"
_f_oo
$ echo "foo" | src/grep --color=auto "."
_foo_
$ echo "foo" | src/grep --color=auto "^."
_f_oo




reply via email to

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