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