How do I read a text file of about 2 GB?

Text FilesNotepad++Openoffice Writer

Text Files Problem Overview


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?

Text Files Solutions


Solution 1 - Text Files

Try Glogg. the fast, smart log explorer.

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

Solution 2 - Text Files

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

Solution 3 - Text Files

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).

Solution 4 - Text Files

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++.

Solution 5 - Text Files

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.

Solution 6 - Text Files

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

Solution 7 - Text Files

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

https://stackoverflow.com/questions/159521/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

Solution 8 - Text Files

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

Solution 9 - Text Files

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.

Solution 10 - Text Files

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

[1]: http://www.geany.org/Download/Releases#windows "Geany for windows"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAbhishek SinghView Question on Stackoverflow
Solution 1 - Text FilesManas Ranjan SahooView Answer on Stackoverflow
Solution 2 - Text FilesKiki MangoView Answer on Stackoverflow
Solution 3 - Text FilestohuwawohuView Answer on Stackoverflow
Solution 4 - Text FilesspacesixView Answer on Stackoverflow
Solution 5 - Text FilesLukas LiesisView Answer on Stackoverflow
Solution 6 - Text FilesraymondboswelView Answer on Stackoverflow
Solution 7 - Text FilesbacktrackView Answer on Stackoverflow
Solution 8 - Text FilesPandiyan CoolView Answer on Stackoverflow
Solution 9 - Text FilesKrishna SarmaView Answer on Stackoverflow
Solution 10 - Text FilesJoelView Answer on Stackoverflow