Entering edit mode
3.6 years ago
shivangi.agarwal800
▴
120
I want to separate 4th column of comma separated list to new rows,
My file is like this
A B C 1,2 D E
I want output like
A B C 1 D E
A B C 2 D E
I am using command as:
awk -F'\t' '{ n=split($4,arr,","); for(i=1;i<=n;i++) print $1"\t"$2"\t"$3"\t"arr[i]"\t"$5"\t"$6 }'
But original file contains 100 columns, so how to print all columns from 5 to 100 as it is not possible to write one by one
how is it related to bioinformatics ?
Collection of R solutions from SO: