GNU bug report logs - #58468
bug in my tr, version (GNU coreutils) 9.1

Previous Next

Package: coreutils;

Reported by: Anton Wessel <Anton_Wessel <at> t-online.de>

Date: Wed, 12 Oct 2022 13:20:02 UTC

Severity: normal

Tags: notabug

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Chris Elvidge <celvidge001 <at> gmail.com>
To: Anton Wessel <Anton_Wessel <at> t-online.de>, 58468 <at> debbugs.gnu.org
Subject: bug#58468: bug in my tr, version (GNU coreutils) 9.1
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 <at> t-onli…/INBOX
> Betreff: Welcome to the "Bug-coreutils" mailing list (Digest mode)
> Von: bug-coreutils-request <at> gnu.org
> An: Anton_Wessel <at> t-online.de
> Datum: 12. Okt.  00:19
> Reply-To: bug-coreutils-request <at> gnu.org
> Message-ID: <mailman.163.1665526797.1198.bug-coreutils <at> gnu.org>
> 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
> 
> Anton_Wessel <at> t-online.de
> 
> 

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




This bug report was last modified 2 years and 220 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.