title: grep - print line before, don't print match
body: <p>How to easily print line above the match and skip the match itself? <code>grep</code> <code>-A</code>, <code>-B</code> and <code>-o</code> opt do not solve it. Maybe some <code>awk</code> magic?</p>
  
  <p>for example:</p>
  
  <pre><code>$ cat foo.txt
  bar
  foo
  baz
  foo
  
  $ cat foo.txt | grep foo-SOMETHING
  bar
  baz
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <ul>
  <li>in case when line 2 and 3 has "foo", then line 1 and 2 should be printed (although I am not very strict here)</li>
  </ul>
  
  <p>Additional feature: consider the example:</p>
  
  <pre><code>bar
  foo
  baz
  foo
  foo
  </code></pre>
  
  <p>This should ideally return</p>
  
  <pre><code>bar
  baz
  foo
  </code></pre>