132

Is there any text editor, which can edit such file?

I've tried:

  • gedit
  • kate
  • nano
  • vim
  • mcedit

without success.

8
  • 12
    Do you need to edit it or just view? If the latter, you can simply use "less" from CLI. Mar 3, 2011 at 12:21
  • 4
    @MrShunz: yes, i want to edit the file. @Bakhtiyor: the answer is "YES" :)
    – cupakob
    Mar 4, 2011 at 6:14
  • 2
    I recommend editing your question to mention the fact that you want to edit the file. That would make it so people didn't have to search through comments to figure out your question and/or if your question is similar enough to one they have. Mar 9, 2011 at 20:13
  • 1
    By any chance are you trying to open the 42 zip bomb base file? I had this problem and I found that a program called "010 editor" worked well
    – user408548
    May 9, 2015 at 15:43
  • Related on Stack Overflow: Working with huge files in linux Jan 11, 2017 at 2:28

16 Answers 16

119

Another method is to use split. Split the file into 8 pieces and manipulate the files with a editor. After that, you reassemble the files again.

split -b 53750k <your-file>

cat xa* > <your-file>


SYNOPSIS
       split [OPTION]... [INPUT [PREFIX]]

-a, --suffix-length=N
              use suffixes of length N (default 2)

       -b, --bytes=SIZE
              put SIZE bytes per output file

       -C, --line-bytes=SIZE
              put at most SIZE bytes of lines per output file

       -d, --numeric-suffixes
              use numeric suffixes instead of alphabetic

       -l, --lines=NUMBER
              put NUMBER lines per output file
7
  • it seems to be the best solution at the moment...
    – cupakob
    Mar 4, 2011 at 14:43
  • 14
    Take note that many editors will add a newline character to the end of your edited file, and do it without informing you! For more info see How to stop Gedit, Gvim, Vim, Nano from adding End-of-File newline char? askubuntu.com/q/20871/2670
    – Peter.O
    Mar 23, 2011 at 6:04
  • 1
    nice way ... and then you should use vim with the single parts ... I hate vim :P but It win all other editor here Dec 18, 2012 at 0:12
  • 1
    @Peter.O: Did the link change? I'm having a hard time finding info on the newline character issue at that URL. :/ Update: Found the referenced question here: askubuntu.com/q/13317/372950
    – rinogo
    Sep 10, 2015 at 17:27
  • 7
    (In short, use nano --nonewlines to avoid the automatic addition of newlines)
    – rinogo
    Sep 10, 2015 at 17:31
58

Try joe. I just used it to edit a ~5G SQL dump file. It took about a minute to open the file and a few minutes to save it, with very little use of swap (on a system with 4G RAM).

6
  • This worked well for me to edit a 1GB xml file. Mar 6, 2014 at 20:45
  • Works well with 2GB files May 10, 2016 at 16:05
  • 1
    Tried on a 14G SQL dump file, but failed with an IO error. (machine has 3GB RAM and 3GB Swap).
    – tehwalrus
    Oct 17, 2016 at 11:31
  • 1
    Wow! 'joe' passes - where many crash! Jan 26, 2017 at 7:03
  • gave joe a 4.6gb file, and nothing happened for a few minutes, so gave up Hex Fiend opens it instantly, but does not seem you can edit in it
    – balupton
    Apr 12, 2018 at 16:11
24

you will not find them. If you want to replace some lines in this file, you can look at with less or grep and use sed to search and replace some lines.

like this:

sed -e 's/oldstuff/newstuff/g' inputFileName > outputFileName

on Wikipedia are some useful examples: http://en.wikipedia.org/wiki/Sed

2
  • 4
    Or especially with the -i flag (in-place), so it behaves essentially like a text editor that will replace the original file content. Feb 28, 2014 at 9:17
  • 1
    Do not use sed -i; that's what ed is for.
    – fkraiem
    Sep 13, 2017 at 0:56
16

Use glogg - the fast, smart log explorer: http://glogg.bonnefon.org/

4
  • 8
    Welcome to Askubuntu.com! Whereas the proposed package may solve the problem, please note that glogg is aimed at searching large files, not actually editing them.
    – Jos
    Apr 22, 2014 at 15:10
  • tried it, it gets always bloated. Oct 25, 2017 at 9:50
  • almost as fast as 010 Editor. But OSS.
    – user2413
    Nov 1, 2019 at 21:11
  • 1
    Yup, to put the comment by @Jos more explicitly - glogg cannot save files
    – sdbbs
    Oct 27, 2020 at 14:35
16

Give it a go, if you like, but such big files become impractical if you want to do "normal" editing; eg, you don't want to go saving your edits too often; it will take too long :)

If it's for a one off, split and join would work quite well, and it is simple enough to chop it up into managable chunks, and then rejoin the pieces... Take note that many editors will add a newline character to the end of your edited file, and do it without informing you! For more info see How to stop Gedit, Gvim, Vim, Nano from adding End-of-File newline char?

Try Gvim if you really want edit such a big file.... I've just loaded a 3.9GB file into it, and all seems to be normal...

Here is an interesting link on the matter, at stackoverflow

6
  • doesn't work with gvim....
    – cupakob
    Mar 4, 2011 at 14:43
  • 1
    @upakob: It just now successfully loaded a 4.5GB file on my system, using Gvim... It took 6 minutes to load. Did you wait long enough? (This is what I mean about saving the file. It will take a long time)... Try running iotop to watch its I/O stats as it is loading.. System Monitor shows I've got 3.2 GB of RAM (Which puzzles me, as I have 4 GB)...
    – Peter.O
    Mar 5, 2011 at 8:25
  • 1
    @upakob: I've tried 8GB this time, and Gvim has successfully loaded it... So Gvim can "technicllly" handle big, Bigger, and maybe even the "BIGGEST" files, but even so, it is somewhat "impractical" (unless you are like me an prepared to wait 41 minute to load 8GB.. :) ... but I don't think I'll bother doing it again.....
    – Peter.O
    Mar 5, 2011 at 9:45
  • You seem to have linked the wrong question.
    – psusi
    Apr 22, 2014 at 14:54
  • You seem to have changed the first link to be the same as the second, rather than to "how to stop gedit, etc from adding end of file newline".
    – psusi
    Apr 24, 2014 at 2:51
15

There is another very simple and fast way to replace content in very large files (which works instead of editing large mysql dumps)

First of all you should install midnight comander - great file manager for linux systems

sudo apt-get install mc

After that you may open any file of any size in "view mode" (with F3 shortcut), switch to HEX view (F4 shortcut) and activate edit mode (F2 shortcut).

For example, I had 3 GB mysql dump, where I want to remove some SQL line. I open view mode, find string, open hex mode and replace content before needed line with MYSQL comment (string "-- ", hex codes 2D 2D 20).

Example: mc hex view

5
  • 3
    My 5 cents - MC failed to edit the 110GB file, but opened in the view mode.
    – Andron
    May 31, 2018 at 14:28
  • 1
    @Andron you still can replace content in view mode Jan 10, 2019 at 13:55
  • interesting. Can you describe how?
    – Andron
    Jan 11, 2019 at 10:51
  • 1
    @Andron well, I already described that in my answer. :) Open view mode, hit F4 for hex and replace any content in any file no matter on size. Jan 12, 2019 at 11:48
  • oh, you are right. Just a note that in my case, I need to replace a long string(s) and that's why it is not ok for me. But yes, in general, this is possible.
    – Andron
    Jan 14, 2019 at 7:00
11

The nedit text editor has been around a long time and is quite capable. It can open a 1.9Gb text file in about 20 seconds. It's a windows-like graphical interface with all the standard text editing features you'd expect like syntax highlighting, indenting, line numbering, and so on.

If you want to resize the window, do that before opening the large file. The X11 Motif is a bit slow on the resize, but it's also a taxing request.

It's in all the standard repositories, so install with:

sudo apt-get install nedit

It is GPLv2 open source.

https://sourceforge.net/projects/nedit/

I'm wading through 30-40Mb text files and nedit handles them easily.

4
  • 2
    Works fine with a dictionary file ~800mb.
    – momo2047
    Nov 21, 2020 at 5:55
  • 2
    There is as well the follow up project XNedit which provided anti-alasing for the fonts!
    – LeO
    Jun 17, 2021 at 9:29
  • Not command line unfortunately
    – John White
    Aug 8, 2022 at 15:09
  • Thanks a lot, loved this one. not only its amazingly fast, but also it took me back to 1998! the looks amazing:)
    – Hossein
    Jan 7 at 7:22
8

010 Editor is great for me, works very fast.

2
  • 1
    fast, but not OSS
    – user2413
    Nov 1, 2019 at 21:11
  • 2
    Note it is a 30-day trial, $50 for home/academic license, $130 commercial (at the time of commenting)
    – Den-Jason
    Mar 25, 2020 at 12:48
5

According to tuxdiary:

HTH

4

You can open the file using hexedit. However you will only be able to change text, not add or remove it.

1
  • This is the right answer: You can edit files that are bigger than your virtual memory, because it edits in-place.
    – Ole Tange
    Mar 10, 2020 at 16:46
3

We get into a situation where log file accumulated to 6GB and need to search by date or string. Few well known text editor could support for such a big file.

Found the JOE editor which is able to load my file of 6GB in 2 mins and enabled to explore the file.

Windows version (sourceforge.net)

Ubuntu (sourceforge.net)

1
  • 1
    16G file opened after about a minute and a half.
    – rob
    Mar 4, 2022 at 14:59
2

According to this Wikipedia article Comparison of text editors VIM among others. I was going to suggest Geany but there is a ? in the field for large file support...

EDIT: I went ahead and tried with geany and gave up after waiting 10 minutes with 3 cores pegged and basically all my memory (virtual and physical) in use the entire time... Not conclusive since it might have managed to open it if I'd been more patient. I looked for and did not find any settings/preferences for handling large files differently as well.

I like fred.bear's answer best.

2

In Windows you have TextPad, EditPad, EmEditor and Kainet.

In Linux you have
kinesics:
http://turtlewar.org/projects/editor/

and many hex editors such as:
bless
http://home.gna.org/bless/
or
wxhexeditor
http://wxhexeditor.sourceforge.net/home.php

All of them allow you to edit very large files (even terabyte) and you can do it easily, without needing to split and recombine the file, which is prone to error and cumbersome.

0

Emacs will do the job (I've edited 10+GiB files in it before), but is approximately as unfriendly to the new user as vim, so may not sit your needs. The learning curve is pretty steep.

0

I used madedit in the past, the only one that survives opening files more than my RAM.

https://github.com/madedit/madedit

-2

I work with NetBeans: it is better than Eclipse in that context.

I know that it is for developers, but you can open any plain text file with it.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .