This is a test version of Biostars. For the public version, visit https://www.biostars.org.
awk command to print multiple columns

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

awk

0 answers

No answers yet.

Log in to answer this question.