Have a very large text file, and need to read lines in the middle.
I have very large txt files (around several hundred megabytes), and I want to be able to skip and read specific lines. More specifically, say the file looks like:
scan 1
scan 2
scan 3
..
..
..
scan 100,000
I want to be able to skip move the filereader immediately to scan 50,000, rather than having to read through scan 1-49,999.
Thanks for any help.
[411 byte] By [
warmonkeda] at [2007-11-26 16:44:55]

If the lines are all different lengths (as in your example) then there is nothing you can do except to read and ignore the lines you want to skip over.
If you are going to be doing this repeatedly, you should consider reformatting those text files into something that supports random access.
If you are going to be doing this repeatedly, you should consider reformatting those text files into something that supports random access. unfortunately not possible, since this format somehow wound up as a standard.
Just out of curiosity, how would you do it if the lines were all the same length?Also, say the file is 100,000,000 bytes. There's no way I can start reading the file at byte 50,000,000?
> Also, say the file is 100,000,000 bytes. There's no> way I can start reading the file at byte 50,000,000?You could use java.io.RandomAccessFile and seek() over the first X bytes.