James Kipp wrote:
> have been trying to figure out a different solution then using the
>>> -i arg. Is there a simple way to just open each file, delete the 5
>>> lines in place and close it(with no backup file), without getting
>>> into sysread, truncate, etc...
>>
>> Not really. What's the problem with using -i?
>
> nothing really, just curiosity
>
[snip]
>
> but we still have not changed the original file, have we :-)

There isn't a way to edit a text file anywhere except the end
without copying the data. Deleting from the beginning requires
that all data after the deletion are moved up to the start of the
file. You could do it within a buffer and write that back to the
same file, but the file would still need to be truncated to empty
it before the data was rewritten. You may as well just write it
to a new file and rename them, which the -i qualifier does
transparently.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to