I want to remove the dot (.) Only from the 4th and 5th columns of the table.
input 1 10057 . A AC 1 10146 . AC. A 1 10177 . A AC 1 10230 . AC .A,AN 1 10349 . CCCTA C,CCCTAA. 1 10389 . .AC A,AN desired output 1 10057 . A AC 1 10146 . AC A 1 10177 . A AC 1 10230 . AC A,AN 1 10349 . CCCTA C,CCCTAA 1 10389 . AC A,AN
So, I tried the following command.
awk 'BEGIN {OFS=FS="\t"} {gsub("\.","",$4);gsub("\.","",$5)}1' input
and I got this result (the entire 4th and 5th columns were deleted).
1 10057 . 1 10146 . 1 10177 . 1 10230 . 1 10349 . 1 10389 .
Could you please indicate where I need to change? Thanks in advance.
unix awk gsub
jamie
source share