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

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

grep-2.5.1: `grep -w --color A' can highlight non-word use of `A'


From: Jim Meyering
Subject: grep-2.5.1: `grep -w --color A' can highlight non-word use of `A'
Date: Tue, 03 Feb 2004 18:54:43 +0100

When I do this, I expect only the first `a' to be highlighted:

  $ echo a cat |grep --color -w a
  a cat

But with grep-2.5.1, both are highlighted.  E.g.,

  $ echo a cat |/bin/grep --color=always -w a|cat -A
  ^[[01;31ma^[[00m c^[[01;31ma^[[00mt$

Of course, I can work around it by using '\<a\>'.
This suggests that -w could be implemented differently
for -E and -G -- where the \< and \> syntax is recognized --
by wrapping the re_compiled patterns with \< and \>,
just as is done for the DFA matcher.




reply via email to

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