I'm sure there are more elegant and probably better solutions, but this is one way
to do it.
#!/usr/bin/env perl
use strict;
use warnings;
my %fields;
my $header = <DATA>;
while (<DATA>) {
chomp;
next if /\A\s*\Z/;
my ($f1, $f2) = split;
push @{ $fields{$f1} }, $f2;
}
for my $k (keys %fields) {
my ($one, $three) = (0, 0); # if either of these remain zero, ID i
+s invalid
for my $values ( @{ $fields{$k} } ) {
++$one if ( $values == 1 );
++$three if ( $values == 3 );
}
print "invalid ID: $k\n" unless $one * $three;
}
__DATA__
field1 field2
3-2000/7.48 1
3-2000/7.48 2
3-2000/7.48 2
3-2000/7.48 2
3-2000/7.48 2
3-2000/7.48 2
3-2000/7.48 2
3-2000/7.48 3
4-0000/8.40 2
4-0000/8.40 2
4-0000/8.40 2
4-0000/8.40 2
4-0000/8.40 2
4-0000/8.40 2
4-0000/8.40 3