I want to conditionally replace column values with the value of a specific column on the same line in a single file, with Unix and awk commands.
For example, I have myfile.txt (3 rows, 5 columns, with tab delimiters):
1 A . C .
2 C T . T
3 T C C .
There is "." in columns 3 through 5. I want to replace those with "." in columns 3 through 5 with the value in column 2 on the same row.
Could you show me any directions?
source
share