Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by IlyaM (Parson)
on Dec 01, 2001 at 03:39 UTC ( #128797=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://128797]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2021-05-07 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (91 votes). Check out past polls.

    Notices?