I have a group of very large (a couple of GB each) text files. I need to add two lines at the beginning of each of these files.
I tried using sed with the following command
sed -i '1iFirstLine' sed -i '2iSecondLine'
The problem with sed is that it processes the entire file, even if it needed to add only two lines at the beginning, and therefore it takes a lot of time.
Is there an alternative way to do this more efficiently without reading the entire file?
Sudar source share