Hi,
I want to duplicate lines of a csv file with header if a column has multiple values. The csv uses semicolon as separator while multiple values are separated with comma. Only the type3 column can have multiple values.
input:
type1;type2;type3 a1;b1;x,y a2;b2;z
output:
a1;b1;x a1;b1;y a2;b2;z
Thanks, Z
Hello iz_82,
Could you please try following and let me know if this helps.
awk -F";" 'NR>1{num=split($NF, A,",");$NF="";for(i=1;i<=num;i++){print $0 A}}' OFS=";" Input_file
Output will be as follows.
Thanks, R. Singh
What have you tried? I would guess that using 'awk' would be a command that may be suited to solve this.