On 25/03/2020 19:44, shwaresyst wrote:
The GNU version is more correct, in my opinion, in that the use of n as a delimiter should take precedence over its use as control character alias with the wording as is. The other versions appear to consider the BRE as <newline> so does not match 'n'.

You have that backwards, don't you? The GNU version lets the use of \n as a control character take precedence over its use as a delimiter. That's why n gets printed: \n\nn is treated as /\n/, which can never match any single-line string, so nothing gets deleted.


  echo n | sed '\n[^\n]nd'

prints nothing with GNU sed, but prints n with FreeBSD sed for the same reason: 'n' does contain a character that is not <newline>, but does not contain any character that is not <n>.

On Wednesday, March 25, 2020 Oğuz <oguzismailuy...@gmail.com> wrote:

     echo n | sed '\n\nnd'

Above command returns 'n' with GNU sed, and nothing with BSD seds and OmniOS sed. [...]

Reply via email to