Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vi: Line too long

Tags:

linux

vi

unix

hp-ux

When I use vi to analyze log files, it sometimes is stuck with the error: 'Line too long'. I can watch the file using more, but that's not what I want.

The command view leads to the same result and less is not installed.

System is HP-UX v B.11.31 U ia64

  1. What does this error mean? Does vi really have a limitation on how many characters per line is allowed?
  2. Is there a workaround how to get the files open and displayed in vi anyway?
like image 780
Nicolas Schwarzentrub Avatar asked Sep 05 '12 07:09

Nicolas Schwarzentrub


People also ask

How do you get to the end of a line in vi?

Moving to Start or End of Line Press ^ to move the cursor to the start of the current line. Press $ to move the cursor to the end of the current line.

How do you wrap lines in vi?

This will make the text you're typing wrap to the next line when it is eight letters from the right-hand side of the screen. To type ^M , press Ctrl-v , then press Enter .

How do I delete 1000 lines in vi?

Delete All Lines Press the Esc key to go to normal mode. Type %d and hit Enter to delete all the lines.

How do I edit lines in vi?

Vi edit modes To enter Insert mode, press i . In Insert mode, you can enter text, use the Enter key to go to a new line, use the arrow keys to navigate text, and use vi as a free-form text editor. To return to Command mode, press the Esc key once. [ Looking for a different text editor?


1 Answers

Find out the limit supported, then use fold

fold -80 your_file | more

Or

fold -80 your_file > /tmp/your_file.0
vim /tmp/your_file.0
like image 150
sehe Avatar answered Oct 04 '22 14:10

sehe