#!/usr/bin/perl use strict; use warnings; # Records separated by blank line $/ = "\r\n\r\n"; # Records we've seen before my %records_seen; while (my $line = ) { # Get list of key fields for record my @key_fields = (split /\s+/, $line)[ -2, -8, -14, -5, -11, -17 ]; # Create composite key for record my $key = join("|",@key_fields); # Process the record if we haven't seen it before if (! exists $records_seen{$key}) { print $line; } # Remember that we've processed the record $records_seen{$key} = $line; } __DATA__ A 83 GLU A 90 GLU^? A 163 ARG A 83 ARG^? A 222 ARG A 5 ARG^? A 229 ALA A 115 ALA~? A 257 ALA A 118 ALA~? A 328 ASP A 95 ASP~? A 83 GLU A 90 GLU^? A 163 ARG A 83 ARG^? A 222 ARG A 5 ARG^? A 83 GLU B 90 GLU^? A 163 ARG B 83 ARG^? A 222 ARG B 5 ARG^? #### Roboticus@Roboticus-PC /robo/Desktop $ perl 856427.pl A 83 GLU A 90 GLU^? A 163 ARG A 83 ARG^? A 222 ARG A 5 ARG^? A 229 ALA A 115 ALA~? A 257 ALA A 118 ALA~? A 328 ASP A 95 ASP~? Roboticus@Roboticus-PC /robo/Desktop $ #### my ($i_new, $j_new, $k_new, $l_new, $m_new, $n_new) = (split /\s+/,$line)[ -2, -8, -14, -5, -11, -17 ];