title: How do I insert text to the 1st line of a file using sed?
body: <p>Hi I'm trying to add text to the 1st line of a file using sed
  so far iv'e tried</p>
  
  <pre><code>#!/bin/bash
  touch test
  sed -i -e '1i/etc/example/live/example.com/fullchain.pem;\' test
  </code></pre>
  
  <p>And this dosn't work 
  also tried </p>
  
  <pre><code>#!/bin/bash
  touch test
  sed -i "1i ssl_certificate /etc/example/live/example.com/fullchain.pem;" test
  </code></pre>
  
  <p>this dosn't seem to work either
  oddly when I try </p>
  
  <pre><code>#!/bin/bash
  touch test
  echo "ssl_certificate /etc/example/live/example.com/fullchain.pem;" &gt; test
  </code></pre>
  
  <p>I get the 1st line of text to appear when i use <code>cat test</code>
  but as soon as i type <code>sed -i "2i ssl_certificate_key /etc/example/live/example.com/privkey.pem;"</code>
  I can't see the information that i sould do on line 2 this being ssl_certificate_key /etc/example/live/example.com/privkey.pem;</p>
  
  <p>so my question to summerise</p>
  
  <ol>
  <li>Can text be inserted into the 1st line of a newly created file using sed?</li>
  <li>If yes whats the best way of inserting text after the 1st line of text?</li>
  </ol>