Best method for seeking to n lines before end of file [ implementation of tail ]



Hello,

Perhaps someone can help me with a problem I have at the moment and is
causing some debate with my colleagues:

What is the best technique to seek to the end of a file and load in
say, the last 10 lines like the tail command does.

My implementation simply seeks to 100 bytes before the end of file, as
I can be fairly sure for the purpose i'm using it for, that this will
give me the data I require. This method is obviously limited as a
generic solution to that problem.

Any ideas would be greatly appreciated,

Graeme Newlands.

.



Relevant Pages