Re:Remove first 300M lines from 700 GB file on 1TB disk
by tyingq on Tuesday September 22, 2020 @10:27AM
(#24554709)
You can do it with a single filehandle, reading the data then seek()ing backwards before you do the writes.
A Perl example that reads a file with the numbers 1 to 100 then replaces the digits with X's:
If his file has lines of equal size, this would be fairly easy to do in place. Would be a little more complicated if not.
[ Parent
| on HN ]
Re:Remove first 300M lines from 700 GB file on 1TB disk
by yencabulator on Wednesday September 23, 2020 @07:50PM
(#24573669)
Number of file handles is irrelevant, all handles for the one file are accessing the same data.