Is there a means of reading files in reverse? I just want to be able to read a file from the beginning and once I read a particular line, I start reading lines backward from there.
Now, I could toss everything into a string array, but the file I'll be reading is roughly 100MB. I don't want 100MB stored in memory. Any ideas here?
Also, is there a way to immediately purge an Array of it's elements without looping and popping? I'm looking to be efficient here.
$> cat infile
Mr. Praline: I'm sorry, I have a cold. I wish to make a complaint!
Owner: We're closin' for lunch.
Mr. Praline: Never mind that, my lad. I wish to complain about this parrot what I purchased not half an hour ago from this very boutique.
Owner: Oh yes, the, uh, the Norwegian Blue...What's,uh...What's wrong with it?
Mr. Praline: I'll tell you what's wrong with it, my lad. 'E's dead, that's what's wrong with it!
Owner: No, no, 'e's uh,...he's resting.
$> tac infile
Owner: No, no, 'e's uh,...he's resting.
Mr. Praline: I'll tell you what's wrong with it, my lad. 'E's dead, that's what's wrong with it!
Owner: Oh yes, the, uh, the Norwegian Blue...What's,uh...What's wrong with it?
Mr. Praline: Never mind that, my lad. I wish to complain about this parrot what I purchased not half an hour ago from this very boutique.
Owner: We're closin' for lunch.
Mr. Praline: I'm sorry, I have a cold. I wish to make a complaint!