Good morning,
I have tab-delimited file, which have repeated names in the first column:
X
X
Y
Y
Y...
(input)
I want to rename these names by assigning numbers to them. The numbering must start anew for each name:
X_CDS1
X_CDS2
Y_CDS1
Y_CDS2
Y_CDS3...
(output)
Can you tell me, please, how this can be implemented in bash?
Thank in advance, Poecile
CodePudding user response:
awk -F '\t' '$1 != "" {$1 = $1"_CDS" seen[$1]} 1' OFS='\t' file.tsv > new.tsv