Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N option: Start from Nth last line #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vanodevium
Copy link

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)

@ravenblackx
Copy link

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.

@vanodevium
Copy link
Author

@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.

@vanodevium
Copy link
Author

vanodevium commented Jun 6, 2022

I changed it a bit to make better use of the current offset and whence

@Mattie112
Copy link

Mattie112 commented Jan 7, 2023

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants