bug-sed
[Top][All Lists]
Advanced

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

bug#54614: GNU Sed 's/.../\n/' disagreement with POSIX


From: Paul Eggert
Subject: bug#54614: GNU Sed 's/.../\n/' disagreement with POSIX
Date: Mon, 28 Mar 2022 10:20:41 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

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.

Traditional Sed (e.g., Solaris, AIX 7) conforms to POSIX. FreeBSD Sed agrees with GNU Sed though, and I would guess that that GNU Sed's behavior is probably more expected. However, this disagreement with POSIX should be documented in the GNU Sed manual (and the manual should recommend backslash-newline over backslash-'n' for portability), and if POSIXLY_CORRECT is set, GNU Sed should conform to POSIX.





reply via email to

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