Here is my file which contains three columns and separate by "\t", and the delimiter of the second column is a blank
1 a b tom
2 a b c sim
3 a mary
4 o l shey
5 c bob
I want to get the first file which the second column contains multiple elements
1 a b tom
2 a b c sim
4 o l shey
and then I want to get the second file like this
1 a tom
1 b tom
2 a sim
2 b sim
2 c sim
4 o shey
4 l shey
Actually, i have tried that
awk -F\\t 'BEGIN {OFS=FS} {n=split($2,aa," ");for (i=1;i<=n;i++) {$2=aa[i]; printf "%s\n" $0 }}'
but it looks like didn't work. Can you give me some advice? thanks.