bug-ed
[Top][All Lists]
Advanced

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

Re: [Bug-ed] Global substitutions that insert newlines


From: Antonio Diaz Diaz
Subject: Re: [Bug-ed] Global substitutions that insert newlines
Date: Thu, 18 Oct 2018 01:10:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

Rob Arthan wrote:
This is an annoying side-effect of the POSIX standardisation: some
implementations of ed allowed the terminating character to be dropped from
a substitution command (i.e., they allowed "s/<pattern>/<text>" as well as
"s/<pattern>/<text>/").  This introduced an "ambiguity" (in the POSIX
description and not, as far as I know, in any implementation) that
eventually caused a useful feature to be dropped from POSIX. A better
solution in the POSiX standard would have been either always to require
the terminating character (as the ed implementations I grew up with did)
or to legislate in favour of the newline interpretation if the terminator
was omitted in the ambiguous cases (which is what the GNU implementation
originally did).

I agree with you, and I think that the line-splitting functionality could perhaps be recovered (and POSIX fixed) given that GNU ed already requires the last delimiter to be present in this case:

http://www.gnu.org/software/ed/manual/ed_manual.html#Commands

"The last delimiter can't be omitted if the 's' command is part of a 'g' or 'v' command-list and is not the last command in the list, because the meaning of the following escaped newline becomes ambiguous."

I'll look into this ASAP (but not very soon).


Best regards,
Antonio.
--
If Spain were not an authoritarian State, catalans would have been allowed to hold their independence referendum years ago. Quebec and Scotland had their independence referendums. Why can't Catalonia have one?



reply via email to

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