title: search for last occurrence of the pattern in a file and delete everything after that excluding pattern line
body: <p>I am trying to search for last occurrence of the pattern in the file and delete everything after the line containing last pattern. I wonder if its possible using awk or sed. thanks in Advance.</p>
  
  <pre><code>aaaaaa bbbbb cccccc
  aaaaaa pattern dddddd
  eeeeee fffff gggg
  qqqq eeee rrrr 
  </code></pre>
  
  <p>desired output:</p>
  
  <pre><code>aaaaaa bbbbb cccccc
  aaaaaa pattern dddddd
  </code></pre>