title: sed - Remove previous line and current line based on pattern
body: <p>I want to delete the previous line and current line based on pattern match on next line</p>
  
  <p>This is my  sample.txt</p>
  
  <pre><code>This is test line 11
  This is test line 999
  This is test line 12
  This is test line 13
  This is test line 16
  This is test line 999
  This is test line 17
  This is test line 18
  </code></pre>
  
  <p>I want to match for pattern 999 and delete both itself and previous line</p>
  
  <p>I am trying this command but i get no output</p>
  
  <pre><code>sed -Ene ':a;N;/999/{d;}; ba; P' sample.txt
  </code></pre>