<div dir="ltr">here's BSD sed on macOS:<div><br></div><div>





<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(170,171,37)"><b>~$ </b></span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">echo one | /usr/bin/sed N</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures;color:rgb(170,171,37)"><b>~$ </b></span><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">echo -e 'one\none\none' | /usr/bin/sed 'N;ax'</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures">sed: 1: "N;ax": command a expects \ followed by text</span></p>
<p class="gmail-p2" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:14px;line-height:normal;font-family:Menlo;color:rgb(170,171,37)"><span class="gmail-s2" style="font-variant-ligatures:no-common-ligatures"><b>~$<span class="gmail-Apple-converted-space"> </span></b></span></p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 12, 2022 at 6:23 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Posix says the N command does NOT trigger the default print at EOF:<br>
<br>
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html" rel="noreferrer" target="_blank">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html</a><br>
<br>
[2addr]N<br>
<br>
  Append the next line of input, less its terminating <newline>, to the pattern<br>
  space, using an embedded <newline> to separate the appended material from the<br>
  original material. Note that the current line number changes.<br>
<br>
  If no next line of input is available, the N command verb shall branch to the<br>
  end of the script and quit without starting a new cycle or copying the pattern<br>
  space to standard output.<br>
<br>
Except that's not what the gnu/dammit version does:<br>
<br>
  $ echo one | sed N<br>
  one<br>
  $ echo -e 'one\none\none' | sed 'N;ax'<br>
  one<br>
  one<br>
  x<br>
  one<br>
<br>
Why? (It looks like N acts as "b" at eof, which will do the default print as<br>
normal at end of pattern, but that's not what posix SAID to do...? I implemented<br>
what posix sed. At the time, I thought that was what the gnu/dammit one was<br>
doing too, but apparently not in devuan baywatch?)<br>
<br>
Rob<br>
_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net" target="_blank">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" rel="noreferrer" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
</blockquote></div>