tail
tail copied to clipboard
N option: Start from Nth last line
Added new flag -N and config option N for start tailing from the last Nth line
Works only if not set Location, so it is mutually exclusive to the Location (and -n flag)
Reading a file backwards one byte at a time is likely to be pretty bad from a performance perspective - it would make more sense to read backwards say min(512, remaining_file_size) bytes at a time and then walk backwards through that buffer one byte at a time.
@ravenblackx I clearly understand that reading byte by byte is not the best way.
But, on the other hand, if the user specifically specifies this parameter, he clearly understands that, firstly, this operation will be one-time, and on the other hand, this is a banal consensus between functionality and speed.
So this functionality means clear aim: as user I wanna read last N lines.
I changed it a bit to make better use of the current offset and whence
Is there any progress on this? I like to have this function. In my case I have a file that might have X lines but really I'm only interested in "new" files. The normal unix tail -f does print the last couple of lines (fine by me). Getting the entire file is not what I'm looking for.
edit: I don't mind the performance hit, it is only done once (when first starting the 'tail')