Oğuz <oguzismailuy...@gmail.com> wrote, on 25 Mar 2020:
>
>     echo n | sed '\n\nnd'
> 
> Above command returns 'n' with GNU sed, and nothing with BSD seds and
> OmniOS sed. The standard says
> 
> 
>    -
> 
>    In a context address, the construction "\cBREc", where *c* is any
>    character other than <backslash> or <newline>, shall be identical to
>    "/BRE/". If the character designated by *c* appears following a
>    <backslash>, then it shall be considered to be that literal character,
>    which shall not terminate the BRE. For example, in the context address
>    "\xabc\xdefx", the second *x* stands for itself, so that the BRE is
>    "abcxdef".
>    -
> 
>    The escape sequence '\n' shall match a <newline> embedded in the pattern
>    space. A literal <newline> shall not be used in the BRE of a context
>    address or in the substitute function.
> 
> 
> but this is not clear at all. Which is the correct behavior here?

Neither is more correct than the other because, as you said yourself,
the standard is unclear. A formal interpretation would say "The standard
is unclear on this issue, and no conformance distinction can be made
between alternative implementations based on this."

Given that implementations differ, we should probably make the
behaviour explicitly unspecified.

-- 
Geoff Clare <g.cl...@opengroup.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England

Reply via email to