[Bug 696688] Re: grep --color= outputs blank line if \r in the input

Launchpad Bug Tracker 696688 at bugs.launchpad.net
Mon May 27 17:05:09 UTC 2013


Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: grep (Ubuntu)
       Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grep in Ubuntu.
https://bugs.launchpad.net/bugs/696688

Title:
  grep --color= outputs blank line if \r in the input

Status in “grep” package in Ubuntu:
  Confirmed

Bug description:
  Binary package hint: grep

  I expect the --color= option in grep to color the match.  Instead,
  grep --color= shows a blank line when \r is in the input.

  For example,

  $ echo -ne "foo\n" | \grep --color=always '^f.*'
  foo
  $ echo -ne "foo\r\n" | \grep --color=always '^f.*'

  $ echo -ne "foo\r\n" | \grep --color=always '^f.*' | od -bc
  0000000 033 133 060 061 073 063 061 155 033 133 113 146 157 157 015 033
          033   [   0   1   ;   3   1   m 033   [   K   f   o   o  \r 033
  0000020 133 155 033 133 113 012
            [   m 033   [   K  \n
  0000026

  grep does find and color the content.  It's just not visible.

  Removing the \r, even after adding color, displays the line.

  $ echo -ne "foo\r\n" | \grep --color=always '^f.*' | tr -d '\r'
  foo

  
  $ grep --version
  GNU grep 2.5.4

  $ lsb_release -a
  No LSB modules are available.
  Distributor ID:	Ubuntu
  Description:	Ubuntu 10.04.1 LTS
  Release:	10.04
  Codename:	lucid

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/696688/+subscriptions




More information about the foundations-bugs mailing list