Similar to this question, but slightly more complex
I have a large txt file, that looks something like this:
" AAAAAAAAAAAAAA.BBBBBBBBBBBBBB.CCCCCCCCCCCCCC.DDDDDDDDDDDDDD.EEEEEEEEEEEEEE.FFFFFFFFFFFFFF.GGGGGGGGGGGGGG.HHHHHHHHHHHHHH.IIIIIIIIIIIIII.JJJJJJJJJJJJJJ.KKKKKKKKKKKKKK. "
Each line break is a ".", the file ends in a linebreak, each line is exactly 14 characters long. GollyJer's answer to the mentioned question is good, but I have a few extra requirements:
- I'd like to be able to input a specific line number and have that one line be returned
- Then I'd like the line that is read to be deleted from the file.
I can't have the real txt be loaded into RAM as it's over 600GB
I don't know where to begin with altering the code to do this. Is this even possible? How can I do this? Thanks
I might explore the walrus operator to clean this up and I really have no idea if this is going to be "fast enough". The idea is to read upto the point you want. read/print the stuff to delete then read the rest:
I think that might be memory intensive so you might produce a more streamy result by doing:
both print
BBBBBBBBBBBBBB.and produce a file like: