[Top][All Lists]

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

Re: [Bug-ed] Change in `s/xyz` 1.13 -> 1.14.2 ?

From: Antonio Diaz Diaz
Subject: Re: [Bug-ed] Change in `s/xyz` 1.13 -> 1.14.2 ?
Date: Mon, 09 Oct 2017 16:13:33 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv: Gecko/20110420 SeaMonkey/2.0.14

Hi Steven,

Steven Terpe wrote:
Now however in ed 1.14.2

* 1s/ bar[ENTER]
# Returns an error
# So we have to do
* 1s/bar/[ENTER]

Is this an intentional change or a bug?

It was done to fix inconsistent behavior and remove incompatibilities with the POSIX standard. The relevant entries in the NEWS file of ed 1.14.2 are:

Fixed inconsistent behavior of the substitute command. It incorrectly
reported 'Invalid pattern delimiter' when the two last delimiters were
omitted after a null regular expression. Now it consistently reports
'Missing pattern delimiter' if the two last delimiters are omitted after
any regular expression (null or not).

Ed no longer accepts newlines in the replacement of a 's' command if it
is part of the command list of a global command, because in this case
the meaning of the newline becomes ambiguous. For the same reason, the
last delimiter can't be omitted if the 's' command is not the last
command in the command list.

And the section 'Commands in ed' of the POSIX standard[1] says:

If the closing delimiter of an RE or of a replacement string (for example, '/' ) in a g, G, s, v, or V command would be the last character before a <newline>, that delimiter can be omitted, in which case the addressed line shall be written. For example, the following pairs of commands are equivalent:

s/s1/s2   s/s1/s2/p
g/s1      g/s1/p
?s1       ?s1?

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html

Best regards,

reply via email to

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