in reply to Prepending header line to HUGE csv file

But instead of prepending the line, it is replacing the existing lines!

Read the lines that are replaced, seek to the beginning, write the header, pad with \0, seek to the end, append the saved lines from the beginning. Problem solved.

If the order of the lines matters, you probably have an XY Problem. Why are you trying to do this, to what end? Is this file to be processed later? if so, how? or is it just an archive?

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'