vendredi 27 février 2015

Separating names separated by "| character" to individual pairs


I want to separate the names in the same line into separate individual pairs.



TMPRSS2|pp9284 AADAT
ERG TMPRSS2|pp9284
TMPRSS2|pp9284 ETV1
PDE4A MIA|MIA-RAB4B|RAB4B|RAB4B-EGLN2|EGLN2


This should be



TMPRSS2 AADAT
pp9284 AADAT
ERG TMPRSS2
ERG pp9284
TMPRSS2 ETV1
pp9284 ETV1
PDE4A MIA
PDE4A MIA-RAB4B
PDE4A RAB4B
PDE4A RAB4B-EGLN2
PDE4A EGLN2


The multiple names are in both the columns so I want individual pairs.I have tried mysql for this as after I have individual pairs I want to compare it with a another table. strsplit in R only works well when the multiple names are in a fixed number.but they vary in each line. Can I do this using sed,awk?



Aucun commentaire:

Enregistrer un commentaire