bug-sed
[Top][All Lists]
Advanced

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

bug#26574: v4.4: POSIX violation with respect to output of a trailing ne


From: Michael Klement
Subject: bug#26574: v4.4: POSIX violation with respect to output of a trailing newline, even with --posix
Date: Wed, 19 Apr 2017 21:43:15 -0400

$ sed --version
sed (GNU sed) 4.4

The POSIX spec. 
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html> states:
"Whenever the pattern space is written to standard output or a named file, sed 
shall immediately follow it with a <newline>."

While GNU Sed's default behavior of preserving the trailing-newline status of 
the input's last line is defensible and can be helpful,
it should exhibit POSIX-compliant behavior when invoked with --posix.

# Acceptable default behavior - the no-trailing-newline status of the input is 
preserved.
$ printf 'a' | sed '' | od -t x1
0000000    61


# SHOULD include a trailing newline, per POSIX, but currently doesn't.
$ printf 'a' | sed --posix '' | od -t x1
0000000    61



Regards,

Michael

reply via email to

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