GNU bug report logs - #54614
GNU Sed 's/.../\n/' disagreement with POSIX

Previous Next

Package: sed;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Mon, 28 Mar 2022 17:21:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 54614 <at> debbugs.gnu.org
Subject: bug#54614: GNU Sed 's/.../\n/' disagreement with POSIX
Date: Mon, 28 Mar 2022 11:39:38 -0700
On 3/28/22 10:20, Paul Eggert wrote:
> POSIX says that this shell command:
> 
>   echo 'abc' | sed 's/b/\n/g'
> 
> should output 'anc', but with GNU Sed it outputs two lines 'a' and 'c', 
> even if POSIXLY_CORRECT is set.

Oh, a further reading of the POSIX spec indicates that the behavior is 
unspecified here. So, please ignore what I wrote about POSIXLY_CORRECT 
etc.; the current GNU Sed behavior is fine. Though it may be helpful to 
document the unportability of \n here.




This bug report was last modified 3 years and 134 days ago.

Previous Next


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