How to add a text file content to the next column of an existing table

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












As a Linux Command Line beginner, I have a pretty basic question.



How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?



Precisely, I have a text file test1.txt that looks like this:



A B


and a test2.txt file that only contains the number value 100.



What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:



A B
C 100


I've tried using the following command:



echo -e "C t" test2.txt>>test1.txt.


I know that by using the command



test2.txt>>test1.txt


I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.







share|improve this question
























    up vote
    0
    down vote

    favorite












    As a Linux Command Line beginner, I have a pretty basic question.



    How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?



    Precisely, I have a text file test1.txt that looks like this:



    A B


    and a test2.txt file that only contains the number value 100.



    What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:



    A B
    C 100


    I've tried using the following command:



    echo -e "C t" test2.txt>>test1.txt.


    I know that by using the command



    test2.txt>>test1.txt


    I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      As a Linux Command Line beginner, I have a pretty basic question.



      How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?



      Precisely, I have a text file test1.txt that looks like this:



      A B


      and a test2.txt file that only contains the number value 100.



      What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:



      A B
      C 100


      I've tried using the following command:



      echo -e "C t" test2.txt>>test1.txt.


      I know that by using the command



      test2.txt>>test1.txt


      I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.







      share|improve this question












      As a Linux Command Line beginner, I have a pretty basic question.



      How do a add a new line to an existing .txt file, that consists of a text string, a tab, and a value of another text file?



      Precisely, I have a text file test1.txt that looks like this:



      A B


      and a test2.txt file that only contains the number value 100.



      What I want to do is to use a command by which I would edit the test1.txt file, and make it look like this:



      A B
      C 100


      I've tried using the following command:



      echo -e "C t" test2.txt>>test1.txt.


      I know that by using the command



      test2.txt>>test1.txt


      I will add a new row to test1.txt, with the value of 100, but what I'm trying to do is to add that value as a next column as I wish to make a table with data.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 11:38









      Ljubo

      1




      1




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













           printf %s $'Ct'; cat test2.txt; >>test1.txt


          or



          ( printf %s $'Ct'; cat test2.txt ) >>test1.txt


          or



          printf %s $'Ct' >>test1.txt
          cat test2.txt >>test1.txt


          or in bash



           printf %s $'Ct'"$(<test2.txt)"; >>test1.txt





          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%2f433403%2fhow-to-add-a-text-file-content-to-the-next-column-of-an-existing-table%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
            0
            down vote













             printf %s $'Ct'; cat test2.txt; >>test1.txt


            or



            ( printf %s $'Ct'; cat test2.txt ) >>test1.txt


            or



            printf %s $'Ct' >>test1.txt
            cat test2.txt >>test1.txt


            or in bash



             printf %s $'Ct'"$(<test2.txt)"; >>test1.txt





            share|improve this answer
























              up vote
              0
              down vote













               printf %s $'Ct'; cat test2.txt; >>test1.txt


              or



              ( printf %s $'Ct'; cat test2.txt ) >>test1.txt


              or



              printf %s $'Ct' >>test1.txt
              cat test2.txt >>test1.txt


              or in bash



               printf %s $'Ct'"$(<test2.txt)"; >>test1.txt





              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                 printf %s $'Ct'; cat test2.txt; >>test1.txt


                or



                ( printf %s $'Ct'; cat test2.txt ) >>test1.txt


                or



                printf %s $'Ct' >>test1.txt
                cat test2.txt >>test1.txt


                or in bash



                 printf %s $'Ct'"$(<test2.txt)"; >>test1.txt





                share|improve this answer












                 printf %s $'Ct'; cat test2.txt; >>test1.txt


                or



                ( printf %s $'Ct'; cat test2.txt ) >>test1.txt


                or



                printf %s $'Ct' >>test1.txt
                cat test2.txt >>test1.txt


                or in bash



                 printf %s $'Ct'"$(<test2.txt)"; >>test1.txt






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 11:45









                Hauke Laging

                53.3k1282130




                53.3k1282130






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433403%2fhow-to-add-a-text-file-content-to-the-next-column-of-an-existing-table%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)