Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use VI to search for lines less than a certain length?

Tags:

vi

I know how to use VI to find lines longer than a certain number of characters:

/\%>80v.\+

But how do I search for lines shorter than a certain number of characters?

like image 826
Nick Avatar asked May 11 '11 14:05

Nick


People also ask

How to move down a line in vi?

To move left, press h . To move right, press l . To move down, press j . To move up, press k .

How to move cursor to next line in vi editor?

Press l to move the cursor right and j to move the cursor down to get the cursor to the S. Then press i to "insert" and hit enter to create a new line.

How do you go to the beginning of a line in Vim?

Press 0 to go to the beginning of a line, or ^ to go to the first non-blank character in a line.


1 Answers

Use

/^.\{,25}$/

to find lines shorter than 25 characters.

like image 62
Bas Bossink Avatar answered Oct 18 '22 12:10

Bas Bossink