#CHROM POS T1 T10 T11 T12 T13 T2 T3 T4 T5 T6 T106 T107 T108 T109 T110 T112 T114 T116 T120 T122 T125 T128 T129 T130
Aradu.A01 300806 H B B B B B B B H B B H B B B B B B B B B B B
Aradu.A01 386907 A A A A A A A A A A A A H A A A A A H A A A A
Aradu.A01 463100 B B A A A A A H B A A H H H H H B A B A H H A
Aradu.A01 471639 A A A A H A A H A A H A A A A A H A A A H A A
Aradu.A01 644024 H B B B B B B B H H B H H B B B H B H B B B H
Aradu.A01 756331 H H H H H H H H B B B H H H H H B H H H B B B
Aradu.A01 768081 A A A A A A A A A A A A A A A A A A A A A A A
Aradu.A01 783066 A A H A H H A A A A H A H A A A A A A H A A H
Aradu.A01 812865 H B H H H H H H H H H H H H H H B B H H B B H
Aradu.A01 976731 A H A H H A H H A H H A H H A A H A H A A A H
Aradu.A01 1089311 A H H H H A A A H A H B A H H H H H A A H H H
Aradu.A01 1089991 A A A H A A H A A H A A A A H A A A A A A A H
Aradu.A01 1113781 H H H H H H H A H H H H H H A H H A H A H H H
Aradu.A01 1160441 B B B B B B H B H B B B B B H B B B B B B B B
Aradu.A01 1638873 B H B B H B B B B B B B H H H B B B B B H B B
Aradu.A01 1638907 B H B B H B B B H B B B H H H B B B B B H B B
Can anyone please help me with an awk code that can only get me the rows which have fields with "A" and "B" in it? The rows with
1) only "A" and "H",
2) only "B" and "H" are NOT to be considered.
Each must have both A and B. If H is also present with A and B then also the row should be considered. In summary, need to have only the rows with "A" and "B" and if "H" is there along with "A" and "B" then that row should also be considered:
NR>1 {for(i=3;i<=NF;i++)
{ if ( $i ~ "A" && $i ~ "B" && $1 ~ "H" ) ;
} ## if ;
## for loop is done
print ;
The above code returns the output file as the input file. }