in reply to Replacing Lines in 100 Gig file

You could try using Tie::File. It ties an array to a file without loading the whole thing into memory.

From there it should be pretty straight forward to loop through the array and strip out the stuff you want to strip. Changes to the array modify the file.

The perldoc for it should tell you what you need to know.

UPDATE: it's the looping line by line that wasn't working for you. Perhaps looping doing something like this

mmm pseudo code

my $cut = 0; while(<FILE>) { if(/<\/root>/) { $cut = 1; } elsif(/<root>/) { $cut = 0; next; # skip this line as well, but stop cutting } if(!$cut) { print OUTFILE $_; } }