How to insert a text at the beginning of a file?

So far I’ve been able to find out how to add a line at the beginning of a file but that’s not exactly what I want. I’ll show it with an example:

File content

some text at the beginning

Result

<added text> some text at the beginning

It’s similar but I don’t want to create any new line with it…

I would like to do this with sed if possible.

18 Answers
18

Leave a Comment