I have a question follow by replace entire string in one column based on matching substring
I would like to replace the string in column 2 with the string in column 3, if the string in column 2 is "unidentified"
I have tried the following code
awk -F'\t' -vOFS='\t' '$2=="unidentified" {$2=$3}1'
Here is my input
OTU1019 Gibberella Gibberella_tricincta
OTU1001 unidentified Glomeraceae_sp
It did the task, but it also changes the file format
Here is the output from that code:
OTU1019 Gibberella Gibberella_tricincta
OTU1001 Glomeraceae_sp
Glomeraceae_sp
The desired output should be:
OTU1019 Gibberella Gibberella_tricincta
OTU1001 Glomeraceae_sp Glomeraceae_sp
How do I keep them in a same line after replacing string?
Thanks!