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.
(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.
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