perl -lne '/\tCM+(\d+)/; print $1 if defined $1 and not $seen{$1}++' file1 > file2