perl -MModern::Perl -ne 'my @l=split /\t/;say $+{ID} if $l[2] =~ /3|5\W-UTR/ and $l[8] =~ /ID=(?.*);/' < input.txt