On Wed, Aug 12, 2015 at 09:57:18AM +0200, Rudolf Sykora wrote: > On 12 August 2015 at 09:48, Ingo Krabbe <ikrabbe....@gmail.com> wrote: > > > Actually sed is a line based command and should add a newline, imho. > > I don't think it should add anything. For itself it should be able to count > newlines (because of the possible use of addresses), but otherwise it > should not do anything extra (it should be possible to pipe through > two seds, for instance). >
>From the POSIX description (used here as some reference), when a line is entered in the pattern space, the trailing new line is discarded. When the pattern space is written to stdout it seems that implicitely the new line is restored---the POSIX description says that the input shall be a text file; and ISTR that with an editor, a newline is entered to the last line because a text file is considered to be an array of newline terminated lines. This means that it is a grey zone and depends on things that are not all explicitely stated and that the p9 sed(1) is not, from the/some specification, at fault. -- Thierry Laronde <tlaronde +AT+ polynum +dot+ com> http://www.kergis.com/ http://www.arts-po.fr/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C