http://www.perlmonks.org?node_id=128797


in reply to What is the best way to remove(delete) specific lines from a very large file?

Read file line by line and write lines you need to another file. Once finished replace old file with new.

Here some code which looks a bit cryptic but check this node, perldoc perlrun and perldoc perlvar and it should be become clear.

{ local $^I = ''; local @ARGV = ($filename); while (<>) { next if CRITERIA_TO_SKIP_LINE; print; } }
  • Comment on Re: What is the best way to remove(delete) specific lines from a very large file?
  • Download Code