vi large files

Once upon a time a colleague asked me if there is a better editor than vi installed on my db server. Well, I was not really about arguing the benefit of ed (less memory usage, no useless error message). But one advantage of ed was (I believed) the ability to read large files

$ vi alert_DB01.log
Out of memory saving lines for undo - try using ed
"alert_DB01.log" 612637 lines, 20458891 characters
Thu Aug 25 16:08:20 2011
LNS: Standby redo logfile selected for thread 1 sequence 6898 for destination LOG_ARCHIVE_DEST_2

of course most of readers are using some clicky fancy tools with colors and/or unlimited undo.

Well, for those who use vi on AIX, check this

$ vi -y 9999999 alert_DB01.log
Tue Oct 26 13:59:12 2010
Starting ORACLE instance (normal)
sskgpgetexecname failed to get name
Picked latch-free SCN scheme 3
Autotune of undo retention is turned on.
ILAT =27
"alert_DB01.log" 612662 lines, 20459538 characters

Oh yes !!!

6 Replies to “vi large files”

  1. Once in a while, the need to read a large log file arises.
    However, I don’t see the convenience of using an editor for this purpose. I rather use a reader: less or zless for compressed files, as long as I don’t need to modify the file.


  2. on the other hand, you probably have trucks of memories and you could increase vi default by setting linelimit in your environment

    export EXINIT=”set ll=200000000″

    so you could edit up to 20M lines. It is only a limit, there is no additional memory usage while editing small files

Leave a Reply