I have a PHP script that works a lot with large text files, mostly log files. The problem is that most of the time I only want a section of it, from one split point to another. But having to read a 2GB text file only to get a small portion of it is slowing the process down.
Is there any way I can read only parts of the text without having to read the entire file into memory?
The data is stored like this:
|18.05.2013: some log info here...
|19.05.2013: some log info here...
|20.05.2013: some log info here...
|21.05.2013: some log info here...
|22.05.2013: some log info here...
| etc...
So if I wanted only "19.05.2012" I would still have to read all the other text as well. Is there any way I can read only that part?
P.S. A database is not an option, splitting the files into smaller files is also impractical.