[svlug] edit a 1GB file

N. Thomas nthomas at cise.ufl.edu
Sun Mar 30 23:04:43 PST 2003

* Matt Billenstein <matt at vazor.com> [2003-03-30 22:28:44 -0800]:
> > > If I want to edit a really big text file, what is the best way to
> > > do it?
> >
> > That rather depends on the types of edits you want to perform.  Most
> > significantly, will they change the size of the file?
> It's a text file and I search for a line matching some pattern and
> replace it with a different line.  I really only do this once in a
> blue moon.  I was getting annoyed with Vim taking 10 minutes to load
> the file, a few minutes to find the line, and then like 5 minutes or
> so to save again.

Use grep(1) to find the line that you want to change, use split(1) to
cut the files down to a manageable size, use vim(1) to edit the data,
and then use cat(1) to join everything back to together again.


N. Thomas
nthomas at cise.ufl.edu
Etiamsi occiderit me, in ipso sperabo

More information about the svlug mailing list