split paste them in rows

Hi,

I have a file as

 ABC  123_456_789   234_678_901
XYZ  1100_1250_1580_1680  1175_1440_1620_1890
so on

What I want my output file to look is "split by underscore and then place the contents in rows"

output

ABC 123  234
ABC 456  678
ABC 789  901
XYZ 1100  1175
XYZ 1250  1440
XYZ 1580  1620
XYZ 1680  1890

Thanks,

awk '{n=split($2,a,"_");split($3,b,"_");for (i=1;i<=n;i++) print $1,a,b}' file
1 Like
awk -F' *|_' '{for(i=2;i<=NF/2+1;i++)print $1,$i,$(i+(NF-1)/2)}' infile

Thanks Bartus11