I have huge text files– each file is as big as 10 GB.
Now, I have with me 2 strings "StringNumber1" and "StringNumber2"
“Stringnumber1” occurs exactly once in each text file, and "StringNumber2" is always after "StringNumber1" (although there can be more than 1 occurrence of "StringNumber2" in the text file).
I want to extract all the text occurring in each file, starting from the match for “StringNumber1” and up to that occurrence of "StringNumber2" that occurs immediately after the matching “StringNumber1” (The content between these occurrences of "StringNumber1" and "StringNumber2" may be few bytes to many Gigabytes)…
How do I extract such content, using least RAM? I want to do this in Java.
Is just using a
BufferedReadernot good enough? Well i never had the problem to read really large files. Do you get some kind of error when using this approch?