I have a perl script to do some minor modification to content of large file. The problem is modification needed is at beginning of file. and since the file is quite huge (>2GB), it can sometimes take very long just to copy rest of remaining data. Is there any way to make it almost as fast as copying (say using cp command)?
while( data = read_data(fh) ) { if( data_to_modify(data) ) { out_fh->write(modified_data); last; # break out } } while( read(fh,buffer,buffer_size) ) { out_fh->write(buffer); }
In reply to Modifying small part of large file by pwagyi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |