[Cialug] Efficiently removing the beginning of a file

Dave Weis djweis at internetsolver.com
Mon May 21 11:33:33 CDT 2007


On Mon, 21 May 2007, Daniel A. Ramaley wrote:
> That only took 2.5 seconds, which is much closer to the theoretical 2
> second time that should be possible. But i guess what i'm curious about
> is the general problem; if there is a large file and you need to remove
> some small number of bytes from the beginning of it, how is that best
> accomplished? If i had needed to remove only 1 byte for example, i
> would have had to have used "ibs=1 skip=1" which would have taken
> around 274 seconds again.

It depends on what you are doing with the file. If it's being used in a 
program that you have written, just use a seek/fseek equivalent for that 
language. It should take basically 0 additional time.

dave

-- 
Dave Weis
djweis at internetsolver.com
http://www.internetsolver.com/



More information about the Cialug mailing list