linuxunixvihp-ux

vi: Line too long


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?

Solution

  • (1) Apparently so :-)

    I've never run into a limitation in vim (a) before but it may be that the vi shipping with HPUX is not vim.

    (2) What sort of analysis are you doing on log files with vi?

    This is the sort of task perfectly suited to text processing tools like sed, awk and Perl, in order of increasing awesomeness.


    (a): You may want to consider grabbing vim if you don't have it already. From the vi_diff part of the documentation (differences between vi and vim):

    Vim has only a few limits for the files that can be edited {Vi: can not handle characters and characters above 128, has limited line length, many other limits}.

    Maximum line length: On machines with 16-bit ints (Amiga and MS-DOS real mode): 32767, otherwise 2147483647 characters. Longer lines are split.

    Maximum number of lines: 2147483647 lines.

    Maximum file size: 2147483647 bytes (2 Gbyte) when a long integer is 32 bits. Much more for 64 bit longs. Also limited by available disk space for the swap-file.