I'm trying to overwrite a text file which I know how to do, but I don't sant to start overwriting it from The beginning. Let's say I have a text file:
Ggh
Hello
Oi
The
See
I don't want to start overwriting it from Ggh. I want to start from Oi and make it into:
Ggh
Hello
Why
My
Hey
I don't want to search through The file and replace The words though since in my case i dont know The words. Thank you
CodePudding user response:
One solution is to just read the first two lines and write them again. Then write the new lines after that.