title: Using sed, Insert a line above or below the pattern?
body: <p>I need to edit a good number of files, by inserting a line or multiple lines either right below a unique pattern or above it. Please advise on how to do that using <code>sed</code>, <code>awk</code>, <code>perl</code> (or anything else) in a shell. Thanks! Example:</p>
  
  <pre><code>some text
  lorem ipsum dolor sit amet
  more text
  </code></pre>
  
  <p>I want to insert <code>consectetur adipiscing elit</code> after <code>lorem ipsum dolor sit amet</code>, so the output file will look like:</p>
  
  <pre><code>some text
  lorem ipsum dolor sit amet
  consectetur adipiscing elit
  more text
  </code></pre>