Remove x number of lines from beginning of file

Dave Smith dave at
Fri Oct 26 07:37:31 MDT 2007

Steve wrote:
> This code is much improved...

The point wasn't to do what sed does, only a little faster, because the 
approach is all wrong. The point is to find a solution that can remove 
the first few lines of a huge file without copying the whole rest of the 
file. In CS speak, we're talking constant vs. linear. In my view, the 
best solution would involve a file system hack as has already been 
proposed. The fuse and loopback options seem most promising.

In other words, you could optimize this C++ code all day long, and it 
won't make any significant difference because you're still bound by the 
linear operation of copying most of the file.


More information about the PLUG mailing list