vi: Line too long

Nicolas Schwarzentrub picture Nicolas Schwarzentrub · Sep 5, 2012 · Viewed 18.8k times · Source

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?

Answer

sehe picture sehe · Sep 5, 2012

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