r/vim • u/timsofteng • Jan 21 '22
Hot to open 60gb text dump in vim?
Hello.
I have 16gb ram and 20gb free disk space.
How can i open 60gb dump file in vim?
10
Upvotes
r/vim • u/timsofteng • Jan 21 '22
Hello.
I have 16gb ram and 20gb free disk space.
How can i open 60gb dump file in vim?
26
u/guildem Jan 21 '22
Even with full optimized (neo)vi(m) I'm almost sure you won't be able to open it.
One possibility is to cut it into smaller files (with
splittools).Another possibility is to search with tools like
sedorripgrep.Finally you can view it with
lessortailor equivalent.13
u/sordina Jan 21 '22
half joking, but you could use ed for this
8
u/torresjrjr Jan 21 '22
You should probably use the Unix shell command "split".
7
u/Altitude3003 Jan 21 '22
If you don't need to edit the files, you could probably use pager tools like
lessormoreinstead, or pipe portions of the file to separate editing files withtail/head.Your best bet at editing it would probably be using a stream editor like
sed6
u/rhinotation Jan 21 '22
You can’t, you would need a text editor that works entirely off the disk. Vim is not such an editor, they are called “buffers” for a reason. There is a quora question about this, with lots of options for Windows in particular. Probably because Windows has historically not had the Unix standard tools available to do this kind of work from the command line. Speaking of which… probably just use ripgrep, sed and awk.
4
u/ilovetacos Jan 21 '22
Here's a question no one's asked yet: why? What's in it that you need to view and edit?
4
u/thlimythnake Jan 22 '22
Download more RAM
3
u/ivster666 Jan 21 '22
Split it into smaller chunks. Opening 60gb in vim is just not smart
3
u/[deleted] Jan 21 '22
When I handle files this big, I either split them into 2GB chunks or I use “less” which reads right off disk instead of buffering large amounts of the file. To be honest, splitting is better because you can search with grep and then open the right one.
3
u/kennpq Jan 21 '22
Others have covered off not using Vim though not really suggested solutions other than splitting, which I'm guessing you're not keen on. Some editors will allow opening, searching, etc., of gargantuan files. One is shed, which does not load the file into memory so is pretty much unlimited, and should easily handle your 60GB file.
https://packages.debian.org/bullseye/shed
Or if on Windows, the freeware HxD would work well too.
I just tried both with a 50GB file and they are instant, search adequately, etc.
2
u/mostlikelynotarobot Jan 21 '22
maybe try xi?
2
u/mcstafford Jan 21 '22
Classic can you/should you conflict?
2
u/cyborgamish Jan 21 '22
XY problem detected 🚨 XY problem detected 🚨alert beep bop 🚨 stream that shit in a nodejs + analyze/transform + pipe it back where it comes from
1
u/worldpotato1 Jan 21 '22
In your situation I would try to split that. Maybe with "head" but don't know if splitting it with head works well.
1
u/shadow_phoenix_pt Jan 21 '22
I would try with lnav or some tool like that.
1
u/moocat Jan 21 '22
What are you trying to do with it? Do you actually want to modify it or just look / search? Assuming it's the latter, I'd recommend using less.
1
u/sogun123 Jan 21 '22
I had success with vis
1
u/gderti Jan 22 '22
Look for the vile editor... Works like vi but much better with huge files... Though I've never tried 60G
1
u/Best-Nefariousness95 Jan 22 '22
Even you can open, you could do nothing. 😂
1
u/[deleted] Jan 23 '22
Has anyone ever considered implementing paging for vim? Why does the entire file have to be prefetched?
-1
u/mestia Jan 21 '22
Since you do not explain why, you can try this: open the file with vim, press ctrl-c, now you can navigate the loaded part of the file.