Working With Large Text Files in OS X
Much as I love TextEdit, it’s an in-memory editor so when I tried to open a 4.5 million-line, .5 Gig text file in it, it simply refused. Not good, that. Made me long for BBEdit which I seem to recall could manage huge text files with speed and grace.
I downloaded TextWrangler and gave that a go. It died with an error -116 (”Size Check failed”, obviously). Given that TextWrangler uses the same text engine as BBEdit, that makes me think BBEdit wouldn’t have fared any better.
Amusingly TextEdit can open it but is slow as molasses (which I don’t begrudge it, really, given the size of the file).
I also tried opening it in nano for fun but as my SQL import error is:
ERROR 1062 (23000) at line 2712199: Duplicate entry '52928' for key 1
and I don’t know how to search by line number in nano, it turns out that isn’t a very efficient way for me to work (I realize the issue there is me, and not nano… unless nano cannot jump to a line number in which case ignorance is bliss).
Ultimately it was Hex Fiend that did the trick, kind’a. Working in a 4.5 million-line text file in a hex editor really blows but at least it was fast and functional and let me find the conflict and fix it.
So if you know of another text editor that can handle massive text files with grace and aplomb, kindly let me know (unless you’re going to say vi or emacs or any variant thereof, in which case kindly bugger off).

Sam Roberts responded on 02 Apr 2008 at 8:00 pm #
Does “less” count as a variant of “vi” just because it uses the same programmer friendly command set?
You don’t need to edit the file, it seems, just look at it, and you might already use less to read man pages…
5g go to line 5
/postal search for string postal
n next search match
h get help
and up and down arrows mean… up and down.
chris responded on 03 Apr 2008 at 9:00 am #
I like that. Handy indeed.
jon responded on 23 Apr 2008 at 11:19 pm #
Can’t nano jump to a specified line?
nano +123 file.txt
Just my 2 cents!
chris responded on 02 May 2008 at 12:01 pm #
Thanks Jon, I learn something every day!