How to combine multiple text files of different lengths and multiple columns by a columnUsing text list to batch-rename filesNeeded simple script/loop/command for input command, execute and output within textfilesHow to combine multiple text files into one text file ordered by date created?Remove duplicated from two files and merge the unique onesDownloading email messages as text files (multiple accounts) from command lineMorge text files from CLI with sort order and rootReplacing text in multiple files with text from a list in orderCollate all data from each .txt file into one results fileRemove all non-numeric characters from text filesawk: pipe output of (conditional) print to gzip

How do I produce this Greek letter koppa: Ϟ in pdfLaTeX?

A ​Note ​on ​N!

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Covering null sets by a finite number of intervals

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

How does Captain America channel this power?

Mistake in years of experience in resume?

Ergodic without atoms implies completely conservative?

How do I check if a string is entirely made of the same substring?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

How to fry ground beef so it is well-browned

Critique of timeline aesthetic

Retract an already submitted recommendation letter (written for an undergrad student)

Was Dennis Ritchie being too modest in this quote about C and Pascal?

Thesis on avalanche prediction using One Class SVM

Magical attacks and overcoming damage resistance

What does "function" actually mean in music?

Should the Product Owner dictate what info the UI needs to display?

Is there any official lore on the Far Realm?

Farming on the moon

If a planet has 3 moons, is it possible to have triple Full/New Moons at once?

Initiative: Do I lose my attack/action if my target moves or dies before my turn in combat?

What happened to Captain America in Endgame?

What is the term for a person whose job is to place products on shelves in stores?



How to combine multiple text files of different lengths and multiple columns by a column


Using text list to batch-rename filesNeeded simple script/loop/command for input command, execute and output within textfilesHow to combine multiple text files into one text file ordered by date created?Remove duplicated from two files and merge the unique onesDownloading email messages as text files (multiple accounts) from command lineMorge text files from CLI with sort order and rootReplacing text in multiple files with text from a list in orderCollate all data from each .txt file into one results fileRemove all non-numeric characters from text filesawk: pipe output of (conditional) print to gzip






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I have 60 text files of different lengths and same column names.



For example:



cat Sample_145_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
19258 circRNA
612 ciRNA

cat Sample_146_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
17791 circRNA
729 ciRNA

cat Sample_147_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
22838 circRNA
686 ciRNA

cat Sample_148_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
19404 circRNA
475 ciRNA


I want to produce a 'master' table of all identified circRNAs, with readnumber as column for each sample and flankintronas rownames:



screen shot of the file










share|improve this question






























    3















    I have 60 text files of different lengths and same column names.



    For example:



    cat Sample_145_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
    19258 circRNA
    612 ciRNA

    cat Sample_146_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
    17791 circRNA
    729 ciRNA

    cat Sample_147_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
    22838 circRNA
    686 ciRNA

    cat Sample_148_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
    19404 circRNA
    475 ciRNA


    I want to produce a 'master' table of all identified circRNAs, with readnumber as column for each sample and flankintronas rownames:



    screen shot of the file










    share|improve this question


























      3












      3








      3








      I have 60 text files of different lengths and same column names.



      For example:



      cat Sample_145_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      19258 circRNA
      612 ciRNA

      cat Sample_146_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      17791 circRNA
      729 ciRNA

      cat Sample_147_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      22838 circRNA
      686 ciRNA

      cat Sample_148_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      19404 circRNA
      475 ciRNA


      I want to produce a 'master' table of all identified circRNAs, with readnumber as column for each sample and flankintronas rownames:



      screen shot of the file










      share|improve this question
















      I have 60 text files of different lengths and same column names.



      For example:



      cat Sample_145_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      19258 circRNA
      612 ciRNA

      cat Sample_146_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      17791 circRNA
      729 ciRNA

      cat Sample_147_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      22838 circRNA
      686 ciRNA

      cat Sample_148_Chimeric.out.junction.new.back_spliced_junction.bed.Circexplorer2.txt | gawk 'print $14' | sort | uniq -c
      19404 circRNA
      475 ciRNA


      I want to produce a 'master' table of all identified circRNAs, with readnumber as column for each sample and flankintronas rownames:



      screen shot of the file







      command-line






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 22:30









      dessert

      25.7k674108




      25.7k674108










      asked Mar 26 at 20:14









      grtgrt

      161




      161




















          1 Answer
          1






          active

          oldest

          votes


















          3
















          If all of the columns in all of the files are in the same order, then just concat them together with >>:



          for x in 1..60; do 
          # These flags for tail just cut of the top line, which is your headers
          tail -n 2 Sample_$x_blah.txt >> Sample_master.txt
          # and the double carat makes the output append^
          done


          If not, then you can write the translations in awk sort of like you had above, i.e.



          $ cat Sample_1.txt 
          col1,col2,col3,col4 #etc
          $ cat Sample_2.txt
          col4,col3,col2,col1
          $ cat Sample_1.txt > Sample_Master.txt # no translation needed
          $ awk 'print $4","$3","$2","$1 ' Sample_2.txt >> Sample_Master.txt


          But with 60 files, that would be more work than- something like writing a python script using python's csv lib...






          share|improve this answer

























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1128946%2fhow-to-combine-multiple-text-files-of-different-lengths-and-multiple-columns-by%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3
















            If all of the columns in all of the files are in the same order, then just concat them together with >>:



            for x in 1..60; do 
            # These flags for tail just cut of the top line, which is your headers
            tail -n 2 Sample_$x_blah.txt >> Sample_master.txt
            # and the double carat makes the output append^
            done


            If not, then you can write the translations in awk sort of like you had above, i.e.



            $ cat Sample_1.txt 
            col1,col2,col3,col4 #etc
            $ cat Sample_2.txt
            col4,col3,col2,col1
            $ cat Sample_1.txt > Sample_Master.txt # no translation needed
            $ awk 'print $4","$3","$2","$1 ' Sample_2.txt >> Sample_Master.txt


            But with 60 files, that would be more work than- something like writing a python script using python's csv lib...






            share|improve this answer





























              3
















              If all of the columns in all of the files are in the same order, then just concat them together with >>:



              for x in 1..60; do 
              # These flags for tail just cut of the top line, which is your headers
              tail -n 2 Sample_$x_blah.txt >> Sample_master.txt
              # and the double carat makes the output append^
              done


              If not, then you can write the translations in awk sort of like you had above, i.e.



              $ cat Sample_1.txt 
              col1,col2,col3,col4 #etc
              $ cat Sample_2.txt
              col4,col3,col2,col1
              $ cat Sample_1.txt > Sample_Master.txt # no translation needed
              $ awk 'print $4","$3","$2","$1 ' Sample_2.txt >> Sample_Master.txt


              But with 60 files, that would be more work than- something like writing a python script using python's csv lib...






              share|improve this answer



























                3












                3








                3









                If all of the columns in all of the files are in the same order, then just concat them together with >>:



                for x in 1..60; do 
                # These flags for tail just cut of the top line, which is your headers
                tail -n 2 Sample_$x_blah.txt >> Sample_master.txt
                # and the double carat makes the output append^
                done


                If not, then you can write the translations in awk sort of like you had above, i.e.



                $ cat Sample_1.txt 
                col1,col2,col3,col4 #etc
                $ cat Sample_2.txt
                col4,col3,col2,col1
                $ cat Sample_1.txt > Sample_Master.txt # no translation needed
                $ awk 'print $4","$3","$2","$1 ' Sample_2.txt >> Sample_Master.txt


                But with 60 files, that would be more work than- something like writing a python script using python's csv lib...






                share|improve this answer

















                If all of the columns in all of the files are in the same order, then just concat them together with >>:



                for x in 1..60; do 
                # These flags for tail just cut of the top line, which is your headers
                tail -n 2 Sample_$x_blah.txt >> Sample_master.txt
                # and the double carat makes the output append^
                done


                If not, then you can write the translations in awk sort of like you had above, i.e.



                $ cat Sample_1.txt 
                col1,col2,col3,col4 #etc
                $ cat Sample_2.txt
                col4,col3,col2,col1
                $ cat Sample_1.txt > Sample_Master.txt # no translation needed
                $ awk 'print $4","$3","$2","$1 ' Sample_2.txt >> Sample_Master.txt


                But with 60 files, that would be more work than- something like writing a python script using python's csv lib...







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 26 at 22:34









                dessert

                25.7k674108




                25.7k674108










                answered Mar 26 at 20:43









                rm-vandarm-vanda

                2,37321523




                2,37321523



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1128946%2fhow-to-combine-multiple-text-files-of-different-lengths-and-multiple-columns-by%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

                    Bunad

                    Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum