I have a data file A.tsv
(field separator = \t
) :
id clade mutation
243 40A S:ojo,L:juju,S:lili
254
267 40B J:jijy,S:asel,M:ase
And I want to print in another column (in a new file B.tsv
) only mutation that start with S:
, like this :
id clade mutation S_mutation
243 40A S:ojo,L:juju,S:lili S:ojo,S:lili
254
267 40B J:jijy,S:asel,M:ase S:asel
I tried some command with awk with no result :
awk -F '\t' 'BEGIN { OFS = FS } NR==1 {$(NF+1)="S_Mutation"} ; NR != 1 { $4 = ($3==^[Ss] ? $4 ) }; 1' A.tsv > B.tsv
Do you have an idea how to do that ? Thanks