On Dec 18, 2005, at 12:32 PM, Thomas Dutch wrote:
> Is it possible to remove one or more lines from a file, without  
> reading
> the whole file and writing it away again? This because I'll have to do
> this with files of 1 gigabyte and larger... Is there a high  
> performance
> solution for this?

In general, no.  I'm answering from the perspective of a typical
Unix/Posix file system.  You can truncate a file to discard some
number of trailing bytes using the ftruncate system call.
In Ruby that system call is accessed via File.truncate.

There is no analogous function for removing bytes at the start
of a file.  You can, of course, seek to any position in a file before
doing IO. In ruby you want to look at IO#seek.

Hope this helps.


Gary Wright