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; } }