194

I have a .txt file whose memory is more than 2 GB. The problem is I cannot open it with Notepad, Notepad++ or any other editor programs.

Any solutions?

Abhishek Singh
  • 10,243
  • 22
  • 74
  • 108
  • 5
    Is there some good reason why all text editors can't open arbitrarily large files? – endolith Feb 10 '16 at 02:11
  • 10
    I don't think this is a duplicate - the other questions asks for a text _editor_. This is looking for a text _reader_. Granted there is an overlap (an editor can be used as a reader), but the solutions can be different. – amaidment Feb 08 '17 at 10:23
  • 5
    Only if SO community could understand that :P – Abhishek Singh Feb 10 '17 at 09:01
  • 1
    @endolith Yes. It has to do with how the editor handles the data. There are really only a couple ways to go -- either load all the data into memory or partial. The easiest way is to load into memory, but then there will be some limitation on how big of a file can be opened.To not have a limitation, the editor would need to come up with a scheme to load a subset for viewing at a time, to provide a small viewport of a large data set and manage swapping in and out of memory from disk as that viewport moves. Then you also have to handle searching, replacing, etc. scopes beyond the small view. – Thomas Carlisle Mar 14 '17 at 17:29
  • 1
    I was going to shout: _"Duh, that's not because of Notepad++ but because you're using a 32-bit editor"_ at you. Turns out it was wise to try before making a fool of myself. I'm using Notepad++ 64-bits and it fails to open files larger than 2GB as well... – Damon Nov 07 '17 at 10:11
  • use `UltraEdit` – Vishrant Jul 30 '18 at 21:55

10 Answers10

190

Try Glogg. the fast, smart log explorer.

I have opened log file of size around 2 GB, and the search is also very fast.

Manas Ranjan Sahoo
  • 1,934
  • 2
  • 12
  • 7
105

WordPad will open any text file no matter the size. However, it has limited capabilities as compared to a text editor.

Kiki Mango
  • 1,133
  • 2
  • 7
  • 2
  • 7
    +1 @Kiki. I just used WordPad to open a 1.2G file that Notepad++ couldn't. – Jesuisme Aug 21 '14 at 12:52
  • 14
    @Joe This DOES answer the original question. The only place where I disagree with Kiki is that WordPad IS a text editor. – Jesuisme Aug 21 '14 at 12:54
  • I tried opening a 1.4 Gb json file and it just hung, didn't open. – punstress Mar 22 '15 at 04:24
  • 1
    4.3GB File will not load in WordPad – Daniel Mills Sep 02 '15 at 08:39
  • 44
    Not true - it choked on 52GB text file. – Paul Jurczak Oct 14 '15 at 15:16
  • I was able to open a file that was too big for Notepad++ in WordPad, but it locked up attempting a find & replace all. – BuvinJ Feb 25 '16 at 20:30
  • 10
    Keep in mind how much memory your machine has. Can't expect to load a 52GB file without a ton of RAM :P – Mavelo May 22 '16 at 19:25
  • 16
    @RobertM. A smart program will not load the entire thing into memory at once. Loading a 52 GB file on a machine with 4 GB RAM is entirely possible. – Millie Smith Dec 20 '16 at 17:40
  • 1
    I agree with @Millie Smith. In the early 80's WordStar did open files which size did not fit in memory. It's just a clever use of internal pagination what is needed. You can even do your own basic implementation of a text reader with the FileSystemObject in Windows. – Fer B. Dec 21 '16 at 11:05
  • @MillieSmith 1) Where did I say it was impossible (though damn-near impossible to use once loaded) 2) Wordpad isn't what I'd call a smart application :P – Mavelo Dec 24 '16 at 20:21
  • @RobertM 1) "Can't expect to load a 52GB file without a ton of RAM". 2) if being x means you do y, that does not mean that doing y automatically makes you x. I assume you're saying that Wordpad loads the file in pieces. That doesn't make it smart. A smart application would do that though. Not that Wordpad is good anyway. It choked on 160 MB on my machine (as did notepad++) – Millie Smith Dec 25 '16 at 17:22
  • 1
    When Notepad++ failed me I ended up here. For future reference, my (only) 1GB file loaded fine in Wordpad (much to my surprise) and wordpad,exe is currently showing almost exactly (very marginally over) 2GB of both working set and peak working set, so I'd guess you'd need at least double the file size in spare RAM to open a file. – Rich Feb 02 '17 at 16:05
  • 2
    Wordpad and Notepad++ choked. I'm opening ~3GB. – EngrStudent Jun 16 '17 at 14:40
  • Loading file in RAM sucks for big files. – Alex78191 Nov 01 '17 at 15:20
  • WordPad failed to open a 1GB plain text document in a computer with 16GB of RAM. At least Notepad++ states quite clearly that it can't open the file. – RAM Jan 12 '18 at 09:59
  • 1
    Yeah... Wordpad just choked on a 27 GB file while Glogg could do it. Maybe it used to be better but not the win10 version. My computer has 16GB of ram and plenty of diskspace BTW. – Gaspa79 Apr 19 '18 at 16:48
  • WordPad couldn't open my 2Gb text file - but UltraEdit opened/edited/saved quickly and easily. – HerrimanCoder Oct 17 '18 at 16:03
  • WordPad couldn't open a 2.4 GB file. If you are a Windows user and trying to just view the file then PowerShell is an option. It is slow though. Command : Get-Content  – Jerin Mar 16 '21 at 22:20
50

Instead of loading / reading the complete file, you could use a tool to split the text file in smaller chunks. If you're using Linux, you could just use the split command (see this stackoverflow thread). For Windows, there are several tools available like HJSplit (see this superuser thread).

Community
  • 1
  • 1
tohuwawohu
  • 13,268
  • 4
  • 42
  • 61
  • HJSplit works for me. According to wiki sourceforge documentation: "Newer versions (5.2+) will deny opening the file and issue an error message. Why is that? Notepad++ is based on a component (Scintilla) which is geared towards providing rich text viewing, with syntax highlighting and code folding, as opposed to bulk text services. There are necessary trade offs. Loading a 200MB file will require around 800MB of memory, and the OS may balk at the memory allocation request." – E A Aug 24 '16 at 11:30
13

I use UltraEdit to edit large files. The maximum size I open with UltraEdit was about 2.5 GB. Also UltraEdit has a good hex editor in comparison to Notepad++.

Mofi
  • 46,139
  • 17
  • 80
  • 143
spacesix
  • 6,173
  • 1
  • 11
  • 4
  • 2
    UltraEdit can edit files of any size independent on size of installed RAM. There is no problem to edit a file with more than 8 GB on a computer having just 2 GB RAM installed. For efficient editing large files with UE some configurations should be changed from default as explained in power tip: [Large file text editor](http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/large_file_handling.html). – Mofi Jun 20 '15 at 21:06
  • 1
    Today I tried it with a 7.6 GB file. It worked fine, but only after changing the configuration, *"Open file without temp file..."* (in *File Handling* → *Temporary Files*). – Peter Mortensen Oct 23 '17 at 13:55
12

EmEditor works quite well for me. It's shareware IIRC but doesn't stop working after the license expires..

raymondboswel
  • 576
  • 4
  • 12
  • 2
    I've tested a trial version of EmEditor at home now, and I'm so impressed I'm going to trial it at work too in Feb. And then buy it. – Relaxed1 Dec 11 '14 at 12:53
  • But then I have more needs like encoding changes, and to do serious editing. Mine are data files not log files. – Relaxed1 Dec 11 '14 at 12:54
  • Upvoted for EmEditor - we use it all the time and it's well worth it! It opens files that are many gigs in size. – itoctopus Jul 27 '16 at 18:06
12

I always use 010 Editor to open huge files. It can handle 2 GB easily. I was manipulating files with 50 GB with 010 Editor :-)

It's commercial now, but it has a trial version.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Lukas Liesis
  • 24,652
  • 10
  • 111
  • 109
9

If you only need to read the file, I can suggest Large Text File Viewer. https://www.portablefreeware.com/?id=693

and also refer this

Text editor to open big (giant, huge, large) text files

else if you would like to make your own tool try this . i presume that you know filestream reader in c#

const int kilobyte = 1024;
const int megabyte = 1024 * kilobyte;
const int gigabyte = 1024 * megabyte;

public void ReadAndProcessLargeFile(string theFilename, long whereToStartReading = 0)
{
    FileStream fileStream = new FileStream(theFilename, FileMode.Open, FileAccess.Read);
    using (fileStream)
    {
        byte[] buffer = new byte[gigabyte];
        fileStream.Seek(whereToStartReading, SeekOrigin.Begin);
        int bytesRead = fileStream.Read(buffer, 0, buffer.Length);
        while(bytesRead > 0)
        {
            ProcessChunk(buffer, bytesRead);
            bytesRead = fileStream.Read(buffer, 0, buffer.Length);
        }
    }
}

private void ProcessChunk(byte[] buffer, int bytesRead)
{
    // Do the processing here
}

refer this kindly

http://www.codeproject.com/Questions/543821/ReadplusBytesplusfromplusLargeplusBinaryplusfilepl

Alex78191
  • 2,383
  • 2
  • 17
  • 24
backtrack
  • 7,996
  • 5
  • 52
  • 99
5

Try Vim, emacs (has a low maximum buffer size limit if compiled in 32-bit mode), hex tools

Pandiyan Cool
  • 6,381
  • 8
  • 51
  • 87
2

There are quite number of tools available for viewing large files. http://download.cnet.com/Large-Text-File-Viewer/3000-2379_4-90541.html This for instance. However, I was successful with larger files viewing in Visual studio. Thought it took some time to load, it worked.

Krishna Sarma
  • 1,852
  • 2
  • 29
  • 52
0

For reading and editing, Geany for Windows is another good option. I've run in to limit issues with Notepad++, but not yet with Geany.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joel
  • 467
  • 1
  • 6
  • 18
  • 3
    I downloaded geany because of this comment (so I have nothing else to say good or bad about it), but it would not open my ~3.3 GB file. – Tim Dec 19 '14 at 20:45
  • 3
    I wasn't able to open a 2.9 GB file either using geany, but it was a lack of resources of my computer itself. I ended up using command line `type filename |more` to load the content I needed. right now I created a file of 2GB and had the same issue, so obviously Geany is not the answer here – Joel Dec 21 '14 at 19:11
  • 5
    I wasnt able to open 680mb file neither. – Marcin Mikołajczyk Jan 02 '15 at 13:35
  • Geany closed while trying to open a 3.3 GB file for me. – Dmitri Sunshine Dec 11 '19 at 21:10