Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Delete specific lines from txt file.

by pvaldes (Chaplain)
on Aug 07, 2012 at 14:57 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986012]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2018-06-19 05:40 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.