Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2016-10-21 11:36 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (288 votes). Check out past polls.