1. Suppose you had a text file with the contents and you wanted to insert a string to the beginning:
    1st line
    2nd line
    3rd line
  2. Run the command:
    sed -i '1i Top of the file!' <filename>
  3. Now the file will look like this:
    Top of the file!
    1st line
    2nd line
    3rd line