Remove x number of lines from beginning of file

Alex Esplin alex.esplin at
Thu Oct 25 19:37:11 MDT 2007

On 10/25/07, Jon Gale <donjuanica at> wrote:
> What would be the most efficient way to remove x number of lines from a very
> large (many gigabyte) file?
> Preliminary tests show that sed is not a good option:


> Is there a better way to do this that won't necessitate scanning the entire
> file just to remove the first x number of lines?

vim test.txt

You could turn that into a script in vim with x as a parameter if you
wanted to automate it.

Or you could do it with a small program that piped the file through a
line at a time and didn't write the first x lines out.

Alex Esplin

More information about the PLUG mailing list