Maybe it would be possible to split the file into smaller files and run scripts in parallel on the chunks?
. So for each chunk there will 2 extra strings - except for the last chunk.
Naturally parallel processing is only viable if you have sufficient CPU & RAM.