Hi,
I have a file like this:
ID : 741158
PARENT ID : 9605
RANK : species
GC ID : 1
MGC ID : 2
SCIENTIFIC NAME : Homo sp. Altai
GENBANK COMMON NAME : Denisova hominin
//
ID : 756884
PARENT ID : 9598
RANK : subspecies
GC ID : 1
MGC ID : 2
SCIENTIFIC NAME : Pan troglodytes ellioti
//
I need just ID number if rank :species. so for this example the uotput should be :741158.
my perl script is like this:
#!/usr/bin/perl -w
use strict;
use warnings;
open (FILE, 'm.txt');
while (my $p = <FILE>){
if ($p =~ /^\/\/\n/){
last;
}elsif ($p =~ /GC ID : 1/){
next;
}elsif ($p =~ /MGC ID : 2/){
next;
}elsif ($p =~ /SCIENTIFIC NAME :\D/){
next;
}elsif ($p =~ /\bspecies$/){
print "ID number";?????
}
}
Any sugeestion? Thanks.
I have a file like this:
ID : 741158
PARENT ID : 9605
RANK : species
GC ID : 1
MGC ID : 2
SCIENTIFIC NAME : Homo sp. Altai
GENBANK COMMON NAME : Denisova hominin
//
ID : 756884
PARENT ID : 9598
RANK : subspecies
GC ID : 1
MGC ID : 2
SCIENTIFIC NAME : Pan troglodytes ellioti
//
I need just ID number if rank :species. so for this example the uotput should be :741158.
my perl script is like this:
#!/usr/bin/perl -w
use strict;
use warnings;
open (FILE, 'm.txt');
while (my $p = <FILE>){
if ($p =~ /^\/\/\n/){
last;
}elsif ($p =~ /GC ID : 1/){
next;
}elsif ($p =~ /MGC ID : 2/){
next;
}elsif ($p =~ /SCIENTIFIC NAME :\D/){
next;
}elsif ($p =~ /\bspecies$/){
print "ID number";?????
}
}
Any sugeestion? Thanks.
Comment