Subject: Re: bug#58468: bug in my tr, version (GNU coreutils) 9.1

From: Chris Elvidge <[email-masked]>
Date: Wed, 12 Oct 2022 15:21:16 +0100

On 11/10/2022 23:47, Anton Wessel wrote:
> in OS KNOPPIX 9.1
> 
> your email:
> +++++
> 
> Verzeichnis: Anton_Wessel@t-onli…/INBOX
> Betreff: Welcome to the "Bug-coreutils" mailing list (Digest mode)
> Von: [email-masked]
> An: [email-masked]
> Datum: 12. Okt.  00:19
> Reply-To: [email-masked]
> Message-ID: <[email-masked]>
> Größe: 3,29 KB
> 
> 
> -----
> 
> test:
> 
> echo -e "a\n\nb" | tr -s '\n'
> 
> or
> 
> echo -e "a\n\nb" | tr -s '\n' '\n'

You have only one empty line! You need 3 \n to get two empty lines.

$ echo -e "a\n\n\nb"
a

b

> 
> both empty lines are removed, not only one.
> 
> Please: is there a wayaround known?
> 
> 
> Regards
> 
> [email-masked]
> 
> 

Put your output through hexdump -c
You will see:

$ echo -e "a\n\n\nb" | hexdump -c
0000000   a  \n  \n  \n   b  \n
0000006

$ echo -e "a\n\n\nb" | tr -s '\n' | hexdump -c
0000000   a  \n   b  \n
0000004