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

[Feature Request] Support for line number seeking #83

Open
sparrc opened this issue Apr 22, 2016 · 6 comments
Open

[Feature Request] Support for line number seeking #83

sparrc opened this issue Apr 22, 2016 · 6 comments

Comments

@sparrc
Copy link

sparrc commented Apr 22, 2016

Thanks for the excellent library :),

I want to request support for seeking by line number, as in the linux tail command:

-n, --lines=[+]NUM
              output the last NUM lines, instead of the last 10; or use -n
              +NUM to output starting with line NUM

Both options would be useful, I know that Go doesn't natively support seeking files by line number, but could probably come up with something fairly efficient, like:

  • --lines=+n, read from beginning of file until you read n-1 newlines, then start from there.
  • --lines=n, read from end of file until you read n newlines, the start from there.

If I find some time I'll try to work on this, and will update the issue if I do.

@edigu
Copy link

edigu commented May 7, 2016

Seeking by line number feature would awesome.

@Nino-K
Copy link
Contributor

Nino-K commented May 30, 2016

@sparrc and @edigu I will add this to the backlog, meanwhile any related PR is welcomed.

@pavel-odintsov
Copy link

Yes, will be nice to have option to limit number of lines in output!

@bharatkrishna
Copy link

When implemented, what's mentioned by @sparrc can be used without -f right? I.e. as in the linux tail command where it'll just print out last n lines without following the file.

@tony-harverson-moonpig
Copy link

@Nino-K do either of the PRs referenced above look like something that might be accepted?

@gen2brain
Copy link

What is the status of this feature request? I see a couple of pull requests, is there a known issue with those, does anyone use them?

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

No branches or pull requests

7 participants