I tried opening a huge (~2GB) file in VIM but it choked. I don't actually need to edit the file, just jump around efficiently.
How can I go about working with very large files in VIM?
I tried opening a huge (~2GB) file in VIM but it choked. I don't actually need to edit the file, just jump around efficiently.
How can I go about working with very large files in VIM?
I had the same problem, but it was a 300GB mysql dump and I wanted to get rid of the
DROP
and changeCREATE TABLE
toCREATE TABLE IF NOT EXISTS
so didn't want to run two invocations ofsed
. I wrote this quick Ruby script to dupe the file with those changes:Invoked like
It's already late but if you just want to navigate through the file without editing it,
cat
can do the job too.or alternatively simple:
Old thread. But nevertheless( pun :) ).
less works efficiently if you don't want to edit and just look around which is the case for examining huge log files.
Search in less works like vi
Best part, it's available by default on most distros. So won't be problem for production environment as well.
I wrote a little script based on Florian's answer that uses nano (my favorite editor):
Use it like this:
In that example, nano will open up lines 3 through 8, you can edit them, and when you save and quit, those lines in the hugefile will automatically be overwritten with your saved lines.