Package: grep Version: 3.1-2 Hello,
I am trying to use grep -w to match a word, but it seems that grep ignores the -w switch and returns all occurencies. Test case: $ cat file1 one two three one-two-three one-two two-three $ grep -w 'two' file1 #or grep -Ew 'two' Result: all four lines of file1 are returned. According to man grep: -w, --word-regexp Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore. This option has no effect if -x is also specified. Since dash '-' does not belong to word-constituent characters i was expecting only first line to be matched : one two three Just for the record , even options \<two\>, or \btwo\b will also return all four lines. Easy workaround for the job would be to use grep ' two ' or grep -E '\stwo\s' But this bug report is focused on the failure of -w flag Cheers, George Vasiliou