[plug] Extreme text editing

J Michael Gilks mike at gilks1.com
Tue Oct 7 22:29:33 WST 2003


On Tue, 7 Oct 2003 10:11 pm, Bernard Blackham wrote:
>
> A crude way would be something like:
>
> $ (head -10557151 bigfile ; echo 'new line here' ; tail +10557153 bigfile)
> > newbigfile $ mv newbigfile bigfile.
>
> Though this requires creating a copy of the file which is possibly
> what took so long in the first place.
>
> My solution #2, if the changes didn't involve changing the filesize
> (ie, no insertions), then you could write a small program (C, Perl,
> whatever bloats your float) to open it in rw mode, seek to the right
> offset (test by reading the data at the seek point), write the new
> bytes, and close... but it was probably safer with vi :) Though this
> method would be much faster.
Probably right to stick with VI solution and have big talks with people about 
accuracy. Just such a shock really when a text file is so big. Really is very 
iffy trying to insert into the middle of the file. Well it got done, just 
glad there wasn't any really easy solution I had not known about.
Thanks.

Love
Mike.

>
> Ideally, you'd use a hexediter to do it for you, if you could find a
> hex editor which didn't read the entire file on load.
>
> Regards,
>
> Bernard.

_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list