URL:
  <http://savannah.gnu.org/bugs/?25063>

                 Summary: grep --color clears line when CR matches (because
of \33[K Erase Line string)
                 Project: grep
            Submitted by: None
            Submitted on: Wed 10 Dec 2008 03:19:12 PM UTC
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

"""
$ echo -en 'foo\r\n' | grep --color=auto 'foo'
foo
$ echo -en 'foo\r\n' | grep --color=auto 'foo.'

$ echo -en 'foo\r\n' | grep 'foo.'
foo
"""

Because grep uses the \33[K Erase Line string to end a colored match, it will
clear the entire line when a legitimate carriage return (CR) matches in a file
with DOS line-endings.

This is not just a theoretical issue. When searching for things at EOL I
can't use 'foo$' for DOS-files, so I need to use 'foo[[:blank:]]*$' and that's
the one that breaks.

I'm not sure what the best/quickest fix here is, but I'd scrap the """There
are no additional disadvantages specific to doing it after SGR END."""-comment
from the grep.c file ;-)

Greetings,
Walter Doekes
OSSO B.V.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?25063>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



Reply via email to