How do I browse a large file

Normally when I want to browse a file I use a text editor. However, many text editors load the entire file into memory and I need to browse a 2 GB file. Specifically, I need to capture a few screens of text after the second occurrence of the string TRAP.

A secondary issue is that the file is likely to contain multiple occurrences of zero bytes (it’s an OS/2 dump and the room my OS/2 system is in currently has no power.)

have you considered using a hex editor like Okteta (KDE) or GHex (Gnome)
Hex editors usually load files from disk and support large files and as your files are not text files but dumps a hex editor seams like a better choice
you could also try mc’s (Midnight Commander) build in viewer/editor as it’s a lot faster then kate/kedit/gedit or use a console editor like vim
install mc run it then select the file and hit F3 or F4 mc is not installed by default but it’s in the main repos

I do not know if this covers your problem, but reading large text file in Unix/Linux there are tools like

more

others prefer

less

well, 2G is not that big. I take it you already tried grepping the file and it came back as binary, right?

Unless you want to split the file, I suggest using vi. It does a fairly good job at very large files and it will not modify them when it comes to line endings and special chars.

Just for the fun of it I pointed it at a 10G file. It took about a minute to load but then was perfectly browsable while using about 4G of RAM.

I normally use “less” for that kind of task.

Bytes that are binary zero, usually show up as “^@” (without the quotes) when using “less”.

*NIX utilities usually stream instead of loading the entire file.
In fact, last week I ran into a Microsoft KB article that required reading the contents of an extremely large text fileon MSWindows. Guess what tool they wanted you to use? VIM.

TSU

Use the F3 and F7 keys in MC the same way you would use the them in FC/2. All my file browsing and most of my editing on OS/2 is with FC/2, while on Linux it’s a relatively even split between MC and FC/L.

A secondary issue is that the file is likely to contain multiple occurrences of zero bytes (it’s an OS/2 dump and the room my OS/2 system is in currently has no power.)
Given power to the OS/2 PC or HD, I’d probably copy the dump to another filename, then try F4 instead of F3. If it refuses to edit, then I’d F3, switch to another vtty, and either copy the content of /dev/vcs# to a file, then put newlines in that saved file where needed, or try a screencap of the F3 screen or window. If the “screens” of the dump literally take more than one screen, I’d configure Xorg with a (panning) virtual desktop 3 or more screens tall to fit the needed dump portion, then get a screenshot of a window using the full screen height. For the general idea e.g. http://fm.no-ip.com/SS/brunosFontDefaults1406-180L2.png 2880 px tall.

For your specific situation,

If you use VIM,
Open a windowed text console and re-size however you wish, anticipating the size of the text you want to capture in your screenshot.

vi *filename* 

Then you can skip to the next occurrence of any text string by typing a forward slash followed by your string

/* text_string *

Take your screenshot.
Repeat the text search followed by another screenshot.
Type the following to exit (assuming you’ve made no changes to the text)

:q

Don’t know what you might mean about your zero byte issue… Are you saying that it’s captured somehow or reported in the text?

TSU

I installed Okteta, but it crashed. MC worked once I googled how to select text for a copy. Thanks.

I tried less, but It seemed to have problems with the file. Midnight Commander worked fine. Thanks.

Given power to the OS/2 PC I’d probably use DFSee or Gamma Tech Utilities, and I’d have a decent keyboard instead of the awful layout that the laptops have. But MC did the job once I googled for text select. Thanks.