View Single Post
Old Jan 31st, 2008, 7:43 PM   #3
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 825
Rep Power: 4 The Dark is on a distinguished road
Re: wunix tail in windows

You don't necessarily want to go through the whole file, it could be gigabytes. I'd try jumping back a block at a time and counting the number of lines in each block.
When you have found enough lines, just start going forward again. You could probably save the lines that you find in a buffer, instead of reading them from the file again, but that would depend on how much memory you want to use.
As to how big a block is, I'm not sure - I'd probably start with 4k but I couldn't tell you why, I just like 4k
The Dark is offline   Reply With Quote