X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=cleanup_merge_map.pl;fp=cleanup_merge_map.pl;h=b00c9e35b6d521228ebd5a73eb14b0f049de312a;hp=0000000000000000000000000000000000000000;hb=359d17a6e36acf6e093bf6975170e845a40742ba;hpb=f8a5c38dcbd897644719faafb801a781975b5c8d diff --git a/cleanup_merge_map.pl b/cleanup_merge_map.pl new file mode 100644 index 0000000..b00c9e3 --- /dev/null +++ b/cleanup_merge_map.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +=head1 NAME + +cleanup_merge_map.pl + +=head2 SUMMARY + +Little helper script used when consoldating +multiple merge maps. + +=cut + +my %bad_subs = (); +my %map = (); +while (<>) { + chomp; + my ($lead, $sub) = split /\t/, $_, -1; + next if exists $bad_subs{$sub}; + if (exists $map{$sub}) { + $bad_subs{$sub}++; + delete $map{$sub}; + next; + } + $map{$sub} = $lead; +} +foreach my $sub (sort keys %map) { + print "$map{$sub}\t$sub\n"; +} + +