This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Want Help regarding Text parsing.

I Have a file Like This

chr1    11873,12612,13220,  12227,12721,14409,
chr1    14361,14969,15795,16606,    14829,15038,15947,16765,
chr1    69090,  70008,

Want to convert it into file like this

chr1    11873   12227
chr1    12612   12721
chr1    13220   14409
chr1    14361   14829
chr1    14969   15038
chr1    15795   15947
chr1    16606   16765
chr1    69090   70008

Any Awk or cut command i can use here to get the output?

awk text

I can't quite work out what the 'rules' you're trying to apply are.. do you just want the string chr1 inserted before each pair of numbers? Though it looks like some numbers need to be dropped and not others.

Sorry, text output looking weird . Not looking like what i want. So i have one file having three coloumns.

1. Chrmosome
2. Start 1 ,Start 2,Start 3 ++
3. END1,END2,END3 ++

want in format like Three coloumns

Chr Start1  END1
Chr Start2  END2

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

Also, please select sensible tags. These are meaningless.

Finally: it's hugely appreciated if you show your own effort when asking questions. Don't make us give you a full solution without working on this yourself.

1 answer

 awk '{n=split($2,a,/[,]/);split($3,b,/[,]/);for(i=1;i<=n;i++) if(a[i]!="") printf("%s\t%s\t%s\n",$1,a[i],b[i]);}' input.txt

Log in to answer this question.