How to convert a file with several spaces into a tab-delimited file?Comparing two text filesOnly delete files but not folders with rmHow do I transpose a row to a column in a tab-delimited file?How do I merge tab-delimited files?using awk inside expect programlist of pattern to be removed from the fileReplace all lines between two patterns (inclusive) with a file contentmerge two files with two common fieldshow can sed match pattern delete line plus one and insert diferent fileGrepping all strings on the same line

Why isn't a binary file shown as 0s and 1s?

Do medium format lenses have a crop factor?

Do Australia and New Zealand have a travel ban on Somalis (like Wikipedia says)?

Manager asking me to eat breakfast from now on

Who or what determines if a curse is valid or not?

May I use a railway velocipede on actively-used British railways?

Does unblocking power bar outlets through short extension cords increase fire risk?

Real orthogonal and sign

Could a US citizen born through "birth tourism" become President?

Why do the digits of a number squared follow a similar quotient?

How can I automate this tensor computation?

Are there any satellites in geosynchronous but not geostationary orbits?

How to tell readers that I know my story is factually incorrect?

Is it possible to have a career in SciComp without contributing to arms research?

Who determines when road center lines are solid or dashed?

Null expletive objects in Latin? "Cariotae cum ficis certandum habent" (Plin. Ep. 1,8)

Making a Dataset that emulates `ls -tlra`?

Locked-up DOS computer beeped on keypress. What mechanism caused that?

What's a German word for »Sandbagger«?

Pauli exclusion principle - black holes

Does 5e follow the Primary Source rule?

BritRail England Passes compared to return ticket for travel in England

I have found a mistake on someone's code published online: what is the protocol?

Applying for jobs with an obvious scar



How to convert a file with several spaces into a tab-delimited file?


Comparing two text filesOnly delete files but not folders with rmHow do I transpose a row to a column in a tab-delimited file?How do I merge tab-delimited files?using awk inside expect programlist of pattern to be removed from the fileReplace all lines between two patterns (inclusive) with a file contentmerge two files with two common fieldshow can sed match pattern delete line plus one and insert diferent fileGrepping all strings on the same line






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








2















I had file1:



MSTRG.10807.1 0.494311896511595 MID 0.423993026403461 2.39379412548345 1.99703339651136
MSTRG.10884.1 0.365770947942799 EARLY 1.46416917664929 1.16816186543633 0.689075392478972
MSTRG.10958.1 0.52855355823638 MID 0.885493751836316 2.28463841550375 1.26867555157512


I used command the sed 's/ /,/g' file1 > file2 and this produced file2:



MSTRG.10807.1,,,0.494311896511595,,,MID,,,,0.423993026403461,,2.39379412548345,,,1.99703339651136
MSTRG.10884.1,,,0.365770947942799,,,EARLY,,1.46416917664929,,,1.16816186543633,,,0.689075392478972
MSTRG.10958.1,,,0.52855355823638,,,,MID,,,,0.885493751836316,,2.28463841550375,,,1.26867555157512


But I want a tab-delimited file.










share|improve this question






























    2















    I had file1:



    MSTRG.10807.1 0.494311896511595 MID 0.423993026403461 2.39379412548345 1.99703339651136
    MSTRG.10884.1 0.365770947942799 EARLY 1.46416917664929 1.16816186543633 0.689075392478972
    MSTRG.10958.1 0.52855355823638 MID 0.885493751836316 2.28463841550375 1.26867555157512


    I used command the sed 's/ /,/g' file1 > file2 and this produced file2:



    MSTRG.10807.1,,,0.494311896511595,,,MID,,,,0.423993026403461,,2.39379412548345,,,1.99703339651136
    MSTRG.10884.1,,,0.365770947942799,,,EARLY,,1.46416917664929,,,1.16816186543633,,,0.689075392478972
    MSTRG.10958.1,,,0.52855355823638,,,,MID,,,,0.885493751836316,,2.28463841550375,,,1.26867555157512


    But I want a tab-delimited file.










    share|improve this question


























      2












      2








      2


      1






      I had file1:



      MSTRG.10807.1 0.494311896511595 MID 0.423993026403461 2.39379412548345 1.99703339651136
      MSTRG.10884.1 0.365770947942799 EARLY 1.46416917664929 1.16816186543633 0.689075392478972
      MSTRG.10958.1 0.52855355823638 MID 0.885493751836316 2.28463841550375 1.26867555157512


      I used command the sed 's/ /,/g' file1 > file2 and this produced file2:



      MSTRG.10807.1,,,0.494311896511595,,,MID,,,,0.423993026403461,,2.39379412548345,,,1.99703339651136
      MSTRG.10884.1,,,0.365770947942799,,,EARLY,,1.46416917664929,,,1.16816186543633,,,0.689075392478972
      MSTRG.10958.1,,,0.52855355823638,,,,MID,,,,0.885493751836316,,2.28463841550375,,,1.26867555157512


      But I want a tab-delimited file.










      share|improve this question
















      I had file1:



      MSTRG.10807.1 0.494311896511595 MID 0.423993026403461 2.39379412548345 1.99703339651136
      MSTRG.10884.1 0.365770947942799 EARLY 1.46416917664929 1.16816186543633 0.689075392478972
      MSTRG.10958.1 0.52855355823638 MID 0.885493751836316 2.28463841550375 1.26867555157512


      I used command the sed 's/ /,/g' file1 > file2 and this produced file2:



      MSTRG.10807.1,,,0.494311896511595,,,MID,,,,0.423993026403461,,2.39379412548345,,,1.99703339651136
      MSTRG.10884.1,,,0.365770947942799,,,EARLY,,1.46416917664929,,,1.16816186543633,,,0.689075392478972
      MSTRG.10958.1,,,0.52855355823638,,,,MID,,,,0.885493751836316,,2.28463841550375,,,1.26867555157512


      But I want a tab-delimited file.







      command-line sed






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 10 at 7:22









      Eliah Kagan

      86.6k22 gold badges241 silver badges383 bronze badges




      86.6k22 gold badges241 silver badges383 bronze badges










      asked Jul 10 at 7:15









      Kousalya DeviKousalya Devi

      263 bronze badges




      263 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          6














          If you want the tab character, use t as the replace pattern instead of ,.



          If you want just one tab (or comma) to replace multiple spaces, add + after the space:



          sed 's/ +/t/g' file1 > file2





          share|improve this answer






























            9














            Use tr:



            tr -s ' ' 't' < file1 > file2



            -s, --squeeze-repeats

            replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that
            character







            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%2f1157191%2fhow-to-convert-a-file-with-several-spaces-into-a-tab-delimited-file%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              6














              If you want the tab character, use t as the replace pattern instead of ,.



              If you want just one tab (or comma) to replace multiple spaces, add + after the space:



              sed 's/ +/t/g' file1 > file2





              share|improve this answer



























                6














                If you want the tab character, use t as the replace pattern instead of ,.



                If you want just one tab (or comma) to replace multiple spaces, add + after the space:



                sed 's/ +/t/g' file1 > file2





                share|improve this answer

























                  6












                  6








                  6







                  If you want the tab character, use t as the replace pattern instead of ,.



                  If you want just one tab (or comma) to replace multiple spaces, add + after the space:



                  sed 's/ +/t/g' file1 > file2





                  share|improve this answer













                  If you want the tab character, use t as the replace pattern instead of ,.



                  If you want just one tab (or comma) to replace multiple spaces, add + after the space:



                  sed 's/ +/t/g' file1 > file2






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 10 at 7:24









                  MelebiusMelebius

                  6,7535 gold badges27 silver badges49 bronze badges




                  6,7535 gold badges27 silver badges49 bronze badges























                      9














                      Use tr:



                      tr -s ' ' 't' < file1 > file2



                      -s, --squeeze-repeats

                      replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that
                      character







                      share|improve this answer



























                        9














                        Use tr:



                        tr -s ' ' 't' < file1 > file2



                        -s, --squeeze-repeats

                        replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that
                        character







                        share|improve this answer

























                          9












                          9








                          9







                          Use tr:



                          tr -s ' ' 't' < file1 > file2



                          -s, --squeeze-repeats

                          replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that
                          character







                          share|improve this answer













                          Use tr:



                          tr -s ' ' 't' < file1 > file2



                          -s, --squeeze-repeats

                          replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that
                          character








                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 10 at 9:07









                          pLumopLumo

                          10.1k21 silver badges48 bronze badges




                          10.1k21 silver badges48 bronze badges



























                              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%2f1157191%2fhow-to-convert-a-file-with-several-spaces-into-a-tab-delimited-file%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

                              Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                              Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                              Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?