I think we already have similar post using sed to add “text” at the beginning of a file
Say: sed -i '1i text' inputfile
But here my question is: my text has many lines, so I put them in a file (file1). And I hope to insert the content in file1 at the beginning of file2.
How can I do that using sed, or other approaches?
thx
edit:
Sorry I’m myself complicating this question!
This is an idiot question because we can simply do by “cat”! 🙂
I’m an idiot
How about doing
(Well, this is not “inplace” editing, though, you probably need to use a temp file or a buffer.)
Notice that in some shells, you will also be able to do