title: insert a line several places below or above certain pattern
body: <p>I have this text:</p>
  
  <pre><code>bar
  
  
  eor
  mv foo bar
  </code></pre>
  
  <p>I want to insert a line 2 or 3 lines above mv because eor repeats along the file and I just need to add the line once.</p>
  
  <p>I tried this:</p>
  
  <pre><code>sed -i '/mv/2i \this' file
  </code></pre>
  
  <p>I tried some awk variations like:</p>
  
  <pre><code>awk '/mv/ { print; print "new line"; previous }2'
  </code></pre>
  
  <p>none of these work. Thank you in advanced for your help </p>