I have lines in a log file, appended chronologically. For example, it could be data from the last 30 days, starting 30 days ago, then 29 days ago, then 28 days ago, etc.
I want to read the file in normal chronological order, but starting from a certain point (e.g., starting 7 days ago, read 7 days ago data, then 6 days ago data, then 5 days ago data, etc.)
One method is just reading the file normally, however for speed reasons I will need to: - seek from the end of the file backward, exponentially, to find the right point to start at - then, once I found the right point to start at, read lines one by one, in forward order
I'm having trouble getting this to work. I started by modifying the answer here: Most efficient way to search the last x lines of a file in python
Can someone help, or provide guidance on a better way to do this?