coreutils
[Top][All Lists]
Advanced

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

Re: Bug#982208: coreutils: cat -E, --show-ends display strangely when CR


From: Pádraig Brady
Subject: Re: Bug#982208: coreutils: cat -E, --show-ends display strangely when CR (\ r) is included.
Date: Tue, 9 Feb 2021 23:01:07 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

On 07/02/2021 13:08, KenichiroMATOHARA wrote:
Package: coreutils
Version: 8.32-4+b1
Severity: minor

Dear Maintainer,

When I create a text file with a newline code of "\r\n" and
`cat` with the `-E, --show-ends` option, "$" is displayed at
the beginning of the line.
When `-A, --show-all` is used, it looks normal.


- Create a file for \r\n
$ echo 'foo
     $ od -c dos.txt
0000000   f   o   o  \r  \n  \t   b   a   r  \r  \n
0000013
   bar' | tr '\n' '\r\n' > dos.txt

- `-E, --show-ends` option
$ cat -E dos.txt
$oo
$       bar
$ cat -nE dos.txt
$    1  foo
$    2          bar

- `-A, --show-all` option
$ cat -A dos.txt
foo ^M$
^Ibar^M$
$ cat -nA dos.txt
      1  foo^M$
      2  ^Ibar^M$

I agree the current behavior is less than useful because:

  * \r\n is common a line end combination
  * catting such a file without options causes it to display normally
  * overwriting the first char with $, loses info

I propose to change the upstream coreutils project
as per the attached, to extend the --show-ends option
to show \r as ^M when the following character is \n.

thanks,
Pádraig

Attachment: cat--show-ends.diff
Description: Text Data


reply via email to

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