title: sed next & Next command
body: <p>Wonder if someone can explain the difference between Next (N) and the next(n) command in sed. i was trying following.</p>
  
  <p>this is my input file</p>
  
  <pre><code>Consult Section 3.1 in the Owner and Operator Guide
  Consult Section 3.1 in the Owner and Operator Guide
  for a description of the tape drives
  available on your system.
  </code></pre>
  
  <p>i was using following (next command)</p>
  
  <pre><code>/Operator/{
  n
  s/Owner and Operator Guide/Installation Guide/
  }
  </code></pre>
  
  <p>result is</p>
  
  <pre><code>Consult Section 3.1 in the Owner and Operator Guide
  Consult Section 3.1 in the Installation Guide
  for a description of the tape drives
  available on your system.
  </code></pre>
  
  <p>then i was using following</p>
  
  <pre><code> /Operator/{
   N
   s/Owner and Operator Guide/Installation Guide/
   }
  </code></pre>
  
  <p>result is </p>
  
  <pre><code>Consult Section 3.1 in the Installation Guide
  Consult Section 3.1 in the Owner and Operator Guide
  for a description of the tape drives
  available on your system.
  </code></pre>
  
  <p>can you please explain why I'm getting two different results ? do i need to use Next command (N) only in multiline pattern space ? and where to use next (n) command. </p>
  
  <p>If i use sed 's/Owner and Operator Guide/Installation Guide/' input.txt  will change everything as expected.</p>