Remove x number of lines from beginning of file

Alex Esplin alex.esplin at gmail.com
Fri Oct 26 09:20:11 MDT 2007


On 10/26/07, Dave Smith <dave at thesmithfam.org> wrote:
> 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.

That's strange, I was trying to help the OP do something a little
faster in as easy a way as possible.  Granted, if I wasn't in the
middle of a particularly trying semester right now it would be fun to
hunt around for an efficiency class changing way of doing it, but
given real-life time constraints, sometimes a quicker, easier solution
just has to work for a while.

-- 
Alex Esplin



More information about the PLUG mailing list