12

When navigating log files with less (e.g., using Space and B), sometimes I run into extremely long lines, as in 120,000 characters long long. It gets slow to navigate around these, I guess because it has to figure out what can go in the terminal and where to put the line breaks.

Everywhere else in my log files the lines are only wrapped at the very most maybe 10 times, never more than a page, that's for sure. So I don't want to do something drastic like not wrap the file.

Is there a way to go to the end of these lines when I hit them?

2
  • 4
    You can always enter -S to disable line wrapping (or start less as less -S) Commented Jan 26, 2016 at 16:25
  • @Stephane Right, but a lot of my lines are longer than the width of the console and only these really long ones are problematic, and they are quite rare. Commented Jan 26, 2016 at 16:28

1 Answer 1

8

Originally I tried /\n, but the correct way to find end-of-lines is /$. (Remember, in regex ^ is the start of the line and $ the end, \n finds the n's.)

In case you are navigating up, use ?^ instead, this skips to the start of the line.

1
  • 4
    See also &!.{1000} to filter out lines of more than 1000 characters. Commented Jan 26, 2016 at 17:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.