Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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.

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 chilling in the Monastery: (10)
As of 2016-06-30 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (403 votes). Check out past polls.