Artificial intelligent assistant

Convert a row in a table to a column here is my 1.file (The delimiter is "\t") ot1 a a,b,c,d,e ot2 b b,c,q ot3 c c,f,g ot4 e a,g,e i want to get the 2.file (The delimiter is "\t") ot1 a a ot1 a b ot1 a c ot1 a d ot1 a e ot2 b b ot2 b c ot2 b q ot3 c c ot3 c f ot3 c g ot4 e a ot4 e g ot4 e e fisrtly, i have try the "sed -i "s/,/\n/g", but i don't konw what to do next? appreciate your help.

Something like can do the work:


awk -F\\t 'BEGIN {OFS=FS} {n=split($3,aa,",");for (i=1;i<=n;i++) {$3=aa[i]; printf "%s\
" $0 }}'


First tabulation delimiter need double escape

then split the 3th token and get the number of elements in splitted array

then replace 3th token in loop with splited elements and print

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 4adf26b7dc774f57d816d8a6c5cab21c