title: What does the 'N' command do in sed?
body: <p>It looks like the 'N' command works on every other line:</p>
  <pre class="lang-sh prettyprint-override"><code>$ cat in.txt 
   a
   b
   c
   d
  $ sed '=;N' in.txt 
  1
   a
   b
  3
   c
   d
  </code></pre>
  <p>Maybe that would be natural because command 'N' joins the next line and changes the current line number. But (I saw this <a href="http://www.thegeekstuff.com/2009/11/unix-sed-tutorial-multi-line-file-operation-with-6-practical-examples/" rel="nofollow noreferrer">here</a>):</p>
  <pre class="lang-sh prettyprint-override"><code>$ sed 'N;$!P;$!D;$d' thegeekstuff.txt
  </code></pre>
  <p>The above example deletes the last two lines of a file. This works not only for even-line-numbered files but also for odd-line-numbered files. In this example 'N' command runs on every line. What's the difference?</p>
  <p>And could you tell me why I cannot see the last line when I run sed like this:</p>
  <pre class="lang-sh prettyprint-override"><code># sed N odd-lined-file.txt
  </code></pre>