Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Remove duplicate entries

by 7stud (Deacon)
on Nov 17, 2010 at 02:06 UTC ( #871893=note: print w/ replies, xml ) Need Help??


in reply to Remove duplicate entries

Whose to say what the correct team spelling is? If the data is the same for similarly spelled team names, how about comparing the data rather than the team name:

my %good_data; my @dups; while (my $line = <DATA>) { my @fields = split /,/, $line, 2; my $team_info = $fields[1]; if (! $good_data{$team_info} ){ $good_data{$team_info} = $line; } else { push @dups, $line; } } for (values %good_data) { print; } print "*" x 20, "\n"; for (@dups) { print; } __DATA__ Group One,Captain1,Phone Number,League Pos,etc. Group-One,Captain1,Phone Number,League Pos,etc. GroupOne,Captain1,Phone Number,League Pos,etc. Group Two,Captain2,Phone Number,League Pos,etc. Group Three,Captain3,Phone Number,League Pos,etc. --output:-- Group Three,Captain3,Phone Number,League Pos,etc. Group One,Captain1,Phone Number,League Pos,etc. Group Two,Captain2,Phone Number,League Pos,etc. ******************** Group-One,Captain1,Phone Number,League Pos,etc. GroupOne,Captain1,Phone Number,League Pos,etc.


Comment on Re: Remove duplicate entries
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-12-22 05:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (110 votes), past polls