[plug] Extreme text editing

James Devenish devenish at guild.uwa.edu.au
Wed Oct 8 07:17:58 WST 2003


In message <BAY10-F584rGTOlFE1w00013e87 at hotmail.com>
on Wed, Oct 08, 2003 at 03:06:35AM +0800, John Clayton wrote:
> I have been reading all the responses to this thread and I don't know too 
> much about sed and using dd to get at the insides of files but what I would 
> do is use split to break up the file into manageable pieces, vi the piece 
> that needed editing and then use cat to stick them back together again.
> I don't know how long the split and cat operations would take but I think 
> that the vi operation would take significantly less time that 45 mins.

You are right, split and cat can be used (I wonder if "I just used
split, now how to I get the files back together?" is a UNIX FAQ).
However, like vi or sed, this requires reading the entire contents of
the file and it doesn't matter how much you split up the file...every
bytes is still read from the disk. This might be the limiting factor.
Something to note about all these techniques (including the one I
suggested) is that they necessitate reading the large file, then writing
smaller files -- that's two lots of disk access before vi is even
invoked. This might actually make things slower! Therefore, dd is one
way of limiting the extent of this problem (provided that you have some
intution about whether you can skip over large regions of the file).



_______________________________________________
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