Adjust columns in a table

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











up vote
2
down vote

favorite
2












I have this table which is messed up



DB Size_in_MB
foobar 11011.2
barfoo 4582.9
donkey 4220.8
shoryuken 555.9
hadouken 220.0
kong 214.8
super_mario_bros_p 211.1


there are unnecessary spaces between columns. I want to add | and adjust the spaces between columns. I tried sed 's/t/|/g'and sed 's/t/t|t/g' but did not work



DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1


I want the table like this:



DB | Size_in_MB
foobar | 11011.2
barfoo | 4582.9
donkey | 4220.8
shoryuken | 555.9
hadouken | 220.0
kong | 214.8
super_mario_bros_p | 211.1









share|improve this question









New contributor




Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    2
    down vote

    favorite
    2












    I have this table which is messed up



    DB Size_in_MB
    foobar 11011.2
    barfoo 4582.9
    donkey 4220.8
    shoryuken 555.9
    hadouken 220.0
    kong 214.8
    super_mario_bros_p 211.1


    there are unnecessary spaces between columns. I want to add | and adjust the spaces between columns. I tried sed 's/t/|/g'and sed 's/t/t|t/g' but did not work



    DB | Size_in_MB
    foobar | 11011.2
    barfoo | 4582.9
    donkey | 4220.8
    shoryuken | 555.9
    hadouken | 220.0
    kong | 214.8
    super_mario_bros_p | 211.1


    I want the table like this:



    DB | Size_in_MB
    foobar | 11011.2
    barfoo | 4582.9
    donkey | 4220.8
    shoryuken | 555.9
    hadouken | 220.0
    kong | 214.8
    super_mario_bros_p | 211.1









    share|improve this question









    New contributor




    Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      2
      down vote

      favorite
      2









      up vote
      2
      down vote

      favorite
      2






      2





      I have this table which is messed up



      DB Size_in_MB
      foobar 11011.2
      barfoo 4582.9
      donkey 4220.8
      shoryuken 555.9
      hadouken 220.0
      kong 214.8
      super_mario_bros_p 211.1


      there are unnecessary spaces between columns. I want to add | and adjust the spaces between columns. I tried sed 's/t/|/g'and sed 's/t/t|t/g' but did not work



      DB | Size_in_MB
      foobar | 11011.2
      barfoo | 4582.9
      donkey | 4220.8
      shoryuken | 555.9
      hadouken | 220.0
      kong | 214.8
      super_mario_bros_p | 211.1


      I want the table like this:



      DB | Size_in_MB
      foobar | 11011.2
      barfoo | 4582.9
      donkey | 4220.8
      shoryuken | 555.9
      hadouken | 220.0
      kong | 214.8
      super_mario_bros_p | 211.1









      share|improve this question









      New contributor




      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have this table which is messed up



      DB Size_in_MB
      foobar 11011.2
      barfoo 4582.9
      donkey 4220.8
      shoryuken 555.9
      hadouken 220.0
      kong 214.8
      super_mario_bros_p 211.1


      there are unnecessary spaces between columns. I want to add | and adjust the spaces between columns. I tried sed 's/t/|/g'and sed 's/t/t|t/g' but did not work



      DB | Size_in_MB
      foobar | 11011.2
      barfoo | 4582.9
      donkey | 4220.8
      shoryuken | 555.9
      hadouken | 220.0
      kong | 214.8
      super_mario_bros_p | 211.1


      I want the table like this:



      DB | Size_in_MB
      foobar | 11011.2
      barfoo | 4582.9
      donkey | 4220.8
      shoryuken | 555.9
      hadouken | 220.0
      kong | 214.8
      super_mario_bros_p | 211.1






      scripting text-formatting






      share|improve this question









      New contributor




      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited yesterday









      Jeff Schaller

      33.7k851113




      33.7k851113






      New contributor




      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked yesterday









      Suzie

      162




      162




      New contributor




      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Suzie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          Try the command column as follows:



          cat file | sed 's/t/,|,/g' | column -s ',' -t
          DB | Size_in_MB
          foobar | 11011.2
          barfoo | 4582.9
          donkey | 4220.8
          shoryuken | 555.9
          hadouken | 220.0
          kong | 214.8
          super_mario_bros_p | 211.1





          share|improve this answer




















          • thank you but this is still doesn't work. the columns are not adjusted!
            – Suzie
            yesterday










          • Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
            – Goro
            yesterday










          • @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
            – Thomas
            yesterday






          • 1




            Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
            – Suzie
            yesterday











          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
          );



          );






          Suzie is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473775%2fadjust-columns-in-a-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
          5
          down vote



          accepted










          Try the command column as follows:



          cat file | sed 's/t/,|,/g' | column -s ',' -t
          DB | Size_in_MB
          foobar | 11011.2
          barfoo | 4582.9
          donkey | 4220.8
          shoryuken | 555.9
          hadouken | 220.0
          kong | 214.8
          super_mario_bros_p | 211.1





          share|improve this answer




















          • thank you but this is still doesn't work. the columns are not adjusted!
            – Suzie
            yesterday










          • Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
            – Goro
            yesterday










          • @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
            – Thomas
            yesterday






          • 1




            Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
            – Suzie
            yesterday















          up vote
          5
          down vote



          accepted










          Try the command column as follows:



          cat file | sed 's/t/,|,/g' | column -s ',' -t
          DB | Size_in_MB
          foobar | 11011.2
          barfoo | 4582.9
          donkey | 4220.8
          shoryuken | 555.9
          hadouken | 220.0
          kong | 214.8
          super_mario_bros_p | 211.1





          share|improve this answer




















          • thank you but this is still doesn't work. the columns are not adjusted!
            – Suzie
            yesterday










          • Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
            – Goro
            yesterday










          • @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
            – Thomas
            yesterday






          • 1




            Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
            – Suzie
            yesterday













          up vote
          5
          down vote



          accepted







          up vote
          5
          down vote



          accepted






          Try the command column as follows:



          cat file | sed 's/t/,|,/g' | column -s ',' -t
          DB | Size_in_MB
          foobar | 11011.2
          barfoo | 4582.9
          donkey | 4220.8
          shoryuken | 555.9
          hadouken | 220.0
          kong | 214.8
          super_mario_bros_p | 211.1





          share|improve this answer












          Try the command column as follows:



          cat file | sed 's/t/,|,/g' | column -s ',' -t
          DB | Size_in_MB
          foobar | 11011.2
          barfoo | 4582.9
          donkey | 4220.8
          shoryuken | 555.9
          hadouken | 220.0
          kong | 214.8
          super_mario_bros_p | 211.1






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          Goro

          7,57753371




          7,57753371











          • thank you but this is still doesn't work. the columns are not adjusted!
            – Suzie
            yesterday










          • Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
            – Goro
            yesterday










          • @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
            – Thomas
            yesterday






          • 1




            Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
            – Suzie
            yesterday

















          • thank you but this is still doesn't work. the columns are not adjusted!
            – Suzie
            yesterday










          • Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
            – Goro
            yesterday










          • @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
            – Thomas
            yesterday






          • 1




            Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
            – Suzie
            yesterday
















          thank you but this is still doesn't work. the columns are not adjusted!
          – Suzie
          yesterday




          thank you but this is still doesn't work. the columns are not adjusted!
          – Suzie
          yesterday












          Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
          – Goro
          yesterday




          Hi @Suzie I just ran the command and the results as listed in my answer. Run the command on your original table!
          – Goro
          yesterday












          @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
          – Thomas
          yesterday




          @Goro: also ran the command but did not work for me either. For me sed 's/s+/,|,/g' did the trick.
          – Thomas
          yesterday




          1




          1




          Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
          – Suzie
          yesterday





          Ah Ok my bad, it worked I was doing it on the second table. Thank you for help!
          – Suzie
          yesterday











          Suzie is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          Suzie is a new contributor. Be nice, and check out our Code of Conduct.












          Suzie is a new contributor. Be nice, and check out our Code of Conduct.











          Suzie is a new contributor. Be nice, and check out our Code of Conduct.













           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473775%2fadjust-columns-in-a-table%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay