I am working with a TAB separated file, as follows:
+ + +
- + .
+ + -
+ + &
+ - )
I want to replace column $3 with "NA", but only if it is not equal to either "+" or "-".
The file should be changed to look as follows:
+ + +
- + NA
+ + -
+ + NA
+ - NA
I have tried the following, but it does not work.
cat $file | awk 'FS=OFS="\t"{ if ($3 !="+" && $3 != "-" ); print }'
How can I do the above?