perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/' fileA fileB >output