title: Insert multiple lines of text before specific line using Bash
body: <p>I am trying to insert a few lines of text before a specific line, but keep getting sed errors when I try to add a new line character.  My command looks like:</p>
  
  <pre><code>sed -r -i '/Line to insert after/ i Line one to insert \\
      second new line to insert \\
      third new line to insert' /etc/directory/somefile.txt
  </code></pre>
  
  <p>The error that is reported is:</p>
  
  <pre><code>sed: -e expression #1, char 77: unterminated `s' command
  </code></pre>
  
  <p>I've tried, using <code>\n</code>, <code>\\</code> (as in the example), no character at all, just moving the second line to the next line.  I've also tried something like:</p>
  
  <pre><code>sed -r -i -e '/Line to insert after/ i Line one to insert'
      -e 'second new line to insert'
      -e 'third new line to insert' /etc/directory/somefile.txt
  </code></pre>
  
  <p>EDIT!: Apologies, I wanted the text inserted BEFORE the existing, not after!</p>