1

I have large tab delimited file like below

ENSBTAP00000053998    GO:0005576    GO:0006952          
ENSBTAP00000014280    GO:0005515                
XP_010996658.1    GO:0005515    GO:0032947          
ENSCAFP00000005761-D107    GO:0006826    GO:0006879    GO:0008199       
XP_010987712.1-D2    GO:0004579    GO:0008250    GO:0016021     
ENSBTAP00000018349-D5    GO:0003677    GO:0003700    GO:0005634    GO:0006355    GO:0043565

How could I convert the above table as shown below

ENSBTAP00000053998    GO:0005576
ENSBTAP00000053998    GO:0006952
ENSBTAP00000014280    GO:0005515
XP_010996658.1    GO:0005515
XP_010996658.1    GO:0032947
ENSCAFP00000005761-D107    GO:0006826
ENSCAFP00000005761-D107    GO:0006879
ENSCAFP00000005761-D107    GO:0008199
XP_010987712.1-D2    GO:0004579
XP_010987712.1-D2    GO:0008250
XP_010987712.1-D2    GO:0016021
ENSBTAP00000018349-D5    GO:0003677
ENSBTAP00000018349-D5    GO:0003700
ENSBTAP00000018349-D5    GO:0005634
ENSBTAP00000018349-D5    GO:0006355
ENSBTAP00000018349-D5    GO:0043565

1 Answer 1

1

With Awk:

awk '{for(i=2;i<=NF;i++) print $1,$i}' OFS='\t' file

or Perl

perl -alne '$x = shift @F; print "$x\t$_" for @F' file

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.