title: sed only the last match pattern
body: <p>I would like to <code>sed</code> only the last match pattern of a text file.</p>
  
  <p>input file:</p>
  
  <pre><code>boy
  boy
  girl
  boy
  </code></pre>
  
  <p>output file:</p>
  
  <pre><code>boy
  boy
  girl
  boys
  </code></pre>