Split multiple column into two columns based on first column

The name of the pictureThe name of the pictureThe name of the pictureClash 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






share|improve this question

























    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






    share|improve this question























      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






      share|improve this question













      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








      share|improve this question












      share|improve this question




      share|improve this question








      edited Jul 5 at 12:01









      steeldriver

      30.9k34877




      30.9k34877









      asked Jul 5 at 11:56









      desu

      544




      544




















          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





          share|improve this answer























            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            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






























            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





            share|improve this answer



























              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





              share|improve this answer

























                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





                share|improve this answer















                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






                share|improve this answer















                share|improve this answer



                share|improve this answer








                edited Jul 5 at 12:28


























                answered Jul 5 at 12:04









                steeldriver

                30.9k34877




                30.9k34877






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    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













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)