更新时间:2023-11-06 17:33:16
使用awk
awk '{split($2,a,",");for(i in a)print $1"\t"a[i]}' file
将第二列分割为逗号,然后为每个分割值打印第一列和该值
Splits the second column on commas and then for each split value, print the first column and that value
也在sed
sed ':1;s/\(\([^\n]*\t\)[^\n]*\),\{1,\}/\1\n\2/;t1' file