Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running Mac OS X 10.8.4 (Mountain Lion) and I am trying to open and scroll through a 42 GB .XML file.

I plan on using an XML parser to parse through it and delete parts, but first I need to know how the document is structured so I can know what parts to save.

How can I open this text / XML file and scroll through it so I can get a glimpse of its structure?

I tried my default text-editor, text-mate, and that couldn't open it. I tried gEdit and that shows the first 10 or so lines, but then quits after trying to load the rest.

I would greatly appreciate any and all suggestions!

share|improve this question
    

3 Answers 3

up vote 1 down vote accepted

The easiest way is to use a terminal pager. Open a terminal and run

less file.txt

or

more file.txt
share|improve this answer
    
less has more chance of dealing with these kind of files. –  SilentStorm Jun 25 '13 at 13:47
    
Thank you! Any suggestions on how I can edit it? Or should I let the script do that? –  Django Johnson Jun 25 '13 at 13:48
    
@DjangoJohnson probably best to let the script do it or to use something like sed. –  terdon Jun 25 '13 at 13:59
    
okay, thank you. –  Django Johnson Jun 25 '13 at 14:04

vi will not read all file at once and will cache it. Give it a try. It can also syntax-hihglight it, so it's a plus over less.

share|improve this answer
    
I tried to edit your good reply so as to place "`" around vi and less. But so minor a correction was rejected by e-boss. I just tried vi on 1 Gbyte file. It's quite fast. –  daniel Azuelos Jun 25 '13 at 14:07
1  
I have more power over my answers. :) –  SilentStorm Jun 25 '13 at 14:16
    
"It's a plus over less" ;). –  daniel Azuelos Jun 25 '13 at 14:31

As @terdon already said: Terminal pagers will work regardless how big the file is.
(42 GB... Just curious how you managed to get a file that big...)

TextWrangler might be able to deal with it.
I just verified that TextWrangler has a maximum limit of about 380 MB per file.

If you have a PC handy (or Wine) you can try the trail version of UltraEdit.
This can 100% certain deal with such files.

share|improve this answer
    
It is a crawl of content from the internet. Part of the internet. I don't have a PC handy. What if I need to edit it on a mac, what do I do then? –  Django Johnson Jun 25 '13 at 13:49
    
UltraEdit is known to work on a Mac using Wine. I routinely use it to edit files larger than the RAM of the computer. TextWrangler which is a native Mac-app might be able to do it too, but I don't know that for sure. I don't have a Mac nearby to verify that. –  Tonny Jun 25 '13 at 14:40
    
Try vi. Seriously. –  SilentStorm Jun 25 '13 at 14:41
1  
@SilentStorm That's what I would do :-) , but if someone needs to ask for a tool, vi(m) is probably not the right tool for him/her. Let's be honest... VI has a learning curve. Something we Unix guys sometimes tend to forget. For someone who grow up with a point and click interface VI is scary like hell. –  Tonny Jun 25 '13 at 14:44
1  
@Tonny VIM is scary. I'm trying to avoid it. But I will use it if I must. –  Django Johnson Jun 25 '13 at 20:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.