Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Delete specific lines from txt file.

by pvaldes (Chaplain)
on Aug 07, 2012 at 14:57 UTC ( [id://986012]=note: print w/replies, xml ) Need Help??


in reply to Delete specific lines from txt file.

Alternatively structure/dump the file as a hash (example below), forget all about duplicated blank lines and extra spaces and delete the hash-key provided as argument to the script. You could have a lot of troubles if some lines are duplicated, new fields are added later for new registers, or some fields are missing and you simply delete five untested lines here and there.

my %sports= ( 'johnlazybones' => { 'firstname' => 'John', 'lastname' => 'lazybones', 'sport' => 'none known, never, ever', }, 'michaelflops' => { 'firstname' => 'Michael', 'lastname' => 'flops', 'sport' => 'sillonball', 'victories' => { '1' => '01-AUG-2012', '2' => '12-SEP-2011', }, }, );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-25 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found