From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 12 Aug 2015 10:13:02 +0200 From: tlaronde@polynum.com To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Message-ID: <20150812081302.GA886@polynum.com> References: <881ffd69444ad67e5460b67e49092763@krabbe.dyndns.org> Mime-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.4.2.3i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Re: [9fans] p9p sed vs linux sed Topicbox-Message-UUID: 66580eec-ead9-11e9-9d60-3106f5b1d025 On Wed, Aug 12, 2015 at 09:57:18AM +0200, Rudolf Sykora wrote: > On 12 August 2015 at 09:48, Ingo Krabbe 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 http://www.kergis.com/ http://www.arts-po.fr/ Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C