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

                              Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

                              Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form