[tpm] ftruncate (was: Fast(er) way of deleting X lines from start of a file)

Tom Legrady legrady at gmail.com
Fri Oct 2 17:54:31 PDT 2009


You probably made a typo typing 'ftruncate', googling it worked for me ...
http://linux.about.com/library/cmd/blcmdl2_ftruncate.htm

But it truncates a file, trimming away stuff from the end. There's 'head',
there's 'tail', there's 'ftruncate', just not what you want .. I'd call it
rhead, 'reverse head', or maybe 'allbut'


Tom

O, n Fri, Oct 2, 2009 at 8:37 PM, Madison Kelly <linux at alteeve.com> wrote:

> Madison Kelly wrote:
>
>> Hi all,
>>
>>  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"?
>>
>>  Thanks all!
>>
>> Madi
>>
>
> While talking about this with my boss and colleague, one mentioned
> "ftruncate" as a possible solution. There was debate about whether this was
> implemented in perl though. I did a google on the topic, but it thought it
> was a typo for 'truncate'. Does such a beast exist?
>
> Madi
>
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20091002/c00cbb74/attachment.html>


More information about the toronto-pm mailing list