bug-grep
[Top][All Lists]
Advanced

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

[bug #25063] grep --color clears line when CR matches (because of \33[K


From: anonymous
Subject: [bug #25063] grep --color clears line when CR matches (because of \33[K Erase Line string)
Date: Wed, 10 Dec 2008 15:19:14 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008111317 Ubuntu/8.04 (hardy) Firefox/3.0.4

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

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