Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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', }, }, );
Comment on Re: Delete specific lines from txt file.
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2016-05-29 22:17 GMT
Find Nodes?
    Voting Booth?