[tpm] Fast(er) way of deleting X lines from start of a file
G. Matthew Rice
matt at starnix.com
Wed Sep 30 09:16:32 PDT 2009
On Wed, 2009-09-30 at 11:39 -0400, Madison Kelly wrote:
> Thus far, I've opened a file, read it in, shifted/ignored the first X
> number of line and then wrote out the resulting file. This works, but
> strikes me as horribly inefficient. Doubly so when the file could be
> larger than RAM.
>
> So then, is there a more efficient/faster way of saying "Delete the
> first X number of lines from file foo"?
Do you have to do it in Perl? You could do:
tail -n +N <in.txt >out.txt
where: N = X + 1
Regards,
--matt
More information about the toronto-pm
mailing list