[sf-lug] file limit in vi?

Michael Paoli Michael.Paoli at cal.berkeley.edu
Thu Sep 27 06:05:48 PDT 2007


Trying not to be too redundant here :-)

Mark well pointed out splitting - generally a quite practical approach
for the rather/quite large files, and/or when one only cares to edit a
rather limited section of a large file.

When splitting, do however use a bit of caution.  Most notably if one
splits so that any of the (non-empty) files don't end with newline,
one may get unexpected results when putting things back together.

Rick also made many excellent points about various vi implementations
and such.
Basically, limits (file size, line length, etc.) tend to vary by:
* vi implementation (source, where and how compiled and for what)
* system architecture/environment (may impose specific limits, or
  vi implementation may use certain convenient (to it) limit sizes for
  the build or execution environment)
* system resources (resource constraints may impose various practical
  limits)
There may also be various practical considerations.  E.g. for "too
large" of a file, some or many edit options may be far too slow and
time consuming to be practical; the time to perform various operations
may, in many cases, show a worse than linear relationship to file size
- at least past some file size threshold.

Also see:
http://mail.pm.org/pipermail/oakland/2006-June/001850.html
for a bit more on some various vi implementation limitations (and
bugs/issues).
I could probably write a whole (smallish?) book on vim annoyances :->
...
I much prefer nvi, and even prefer ye olde classic vi, complete with
its limitations and bugs, over vim.
(my latest vim annoyance: vim really sucks at non-ASCII characters,
it ends up not correctly drawing the screen or placing the cursor -
e.g. the cursor is often shown on the screen at a location other than
the active editing position ... ugh! ... nvi of course handles such
quite reasonably and reliably, and even 20+ year old vi handles such
much better than vim; and last I checked, Red Hat didn't offer nvi
... but that could be a whole other book of annoyances, bugs, and
stupidities).

Quoting Mark G Sobell <mark at sobell.com>:
> You can use split to break it into bite-sized pieces.
> On Wednesday 26 September 2007, Alden Meneses wrote:
> > I am trying to vi a 92MB file but it complains that there are too many
> > lines in the file. Is there another utility I can use to modify the file?

Quoting Rick Moen <rick at linuxmafia.com>:
> Limits in "vi" depend, by the way, on which implementation you're using:
> primodial BSD-derived vi
> nvi
> vim
> elvis
> (etc.)
>
> The _actual_ internal limits in vim, per se, appear to be 2GB on 32-bit
> machines, and vastly, vastly longer on 64-bit machines with 64-bit long
> integers.  You can set vim variable "linelimit" to 2147483647 lines
> to set the the maximum number of lines that vim is _willing_ to open
> to enable loading of up to 2GB files on 32-bit machines.  That might
> well be your immediate problem.




More information about the sf-lug mailing list