Split multiple column into two columns based on first column

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
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
linux command-line
add a comment |Â
up vote
1
down vote
favorite
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
linux command-line
add a comment |Â
up vote
1
down vote
favorite
1
up vote
1
down vote
favorite
1
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
linux command-line
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
linux command-line
edited Jul 5 at 12:01
steeldriver
30.9k34877
30.9k34877
asked Jul 5 at 11:56
desu
544
544
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
With Awk:
awk 'for(i=2;i<=NF;i++) print $1,$i' OFS='t' file
or Perl
perl -alne '$x = shift @F; print "$xt$_" for @F' file
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
With Awk:
awk 'for(i=2;i<=NF;i++) print $1,$i' OFS='t' file
or Perl
perl -alne '$x = shift @F; print "$xt$_" for @F' file
add a comment |Â
up vote
1
down vote
accepted
With Awk:
awk 'for(i=2;i<=NF;i++) print $1,$i' OFS='t' file
or Perl
perl -alne '$x = shift @F; print "$xt$_" for @F' file
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
With Awk:
awk 'for(i=2;i<=NF;i++) print $1,$i' OFS='t' file
or Perl
perl -alne '$x = shift @F; print "$xt$_" for @F' file
With Awk:
awk 'for(i=2;i<=NF;i++) print $1,$i' OFS='t' file
or Perl
perl -alne '$x = shift @F; print "$xt$_" for @F' file
edited Jul 5 at 12:28
answered Jul 5 at 12:04
steeldriver
30.9k34877
30.9k34877
add a comment |Â
add a comment |Â
Â
draft saved
draft discarded
Â
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f453605%2fsplit-multiple-column-into-two-columns-based-on-first-column%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password