Getting two columns that begin with the same letter

Hello all !

I have a file that has a list of plant genes and it looks like this:
01-0223: Os05g0168800 Sb09g005020 0.650 speciation
01-0224: Os01g0168200 Os05g0169000 1.083 WGD
01-0224: Os05g0169000 Sb09g005030 0.670 speciation
01-0225: Os01g0168300 Sb03g004660 0.522 speciation

I want to get the lines where column 2 and column 3 both begin with "O" and to ignore the lines where either column 1 or 2 begins with an "S"

I have tried this

use warnings;

open (FILE, "genes.txt");
while ( $line = ) {
chomp $line;
if ( [2,3] =~ "^O") {
print $line ;}
}
exit;

but it doesn't work.
Any ideas? Thanks !
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories