Adjust columns in a table

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











up vote
1
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
    1
    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
      1
      down vote

      favorite
      2









      up vote
      1
      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 37 mins ago









      Jeff Schaller

      33.6k851113




      33.6k851113






      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 57 mins ago









      Suzie

      82




      82




      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
          3
          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
            50 mins ago










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










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






          • 1




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











          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
          3
          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
            50 mins ago










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










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






          • 1




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















          up vote
          3
          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
            50 mins ago










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










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






          • 1




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













          up vote
          3
          down vote



          accepted







          up vote
          3
          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 55 mins ago









          Goro

          7,13253066




          7,13253066











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










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










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






          • 1




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

















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










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










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






          • 1




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
















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




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












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




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












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




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




          1




          1




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





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











          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













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery