How can I wrap text into two columns?

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





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








5















fold can wrap the line if it has more than a certain amount of characters. However, I want to wrap a text file which has less than 40 characters in each line into two columns (80 chars per line total).



I want to make



apple
banana
(28 items omitted)
grape
guava


into



apple ...
banana ...
(12 items omitted) (12 items omitted)
... grape
... guava


How can I make it?










share|improve this question






























    5















    fold can wrap the line if it has more than a certain amount of characters. However, I want to wrap a text file which has less than 40 characters in each line into two columns (80 chars per line total).



    I want to make



    apple
    banana
    (28 items omitted)
    grape
    guava


    into



    apple ...
    banana ...
    (12 items omitted) (12 items omitted)
    ... grape
    ... guava


    How can I make it?










    share|improve this question


























      5












      5








      5








      fold can wrap the line if it has more than a certain amount of characters. However, I want to wrap a text file which has less than 40 characters in each line into two columns (80 chars per line total).



      I want to make



      apple
      banana
      (28 items omitted)
      grape
      guava


      into



      apple ...
      banana ...
      (12 items omitted) (12 items omitted)
      ... grape
      ... guava


      How can I make it?










      share|improve this question
















      fold can wrap the line if it has more than a certain amount of characters. However, I want to wrap a text file which has less than 40 characters in each line into two columns (80 chars per line total).



      I want to make



      apple
      banana
      (28 items omitted)
      grape
      guava


      into



      apple ...
      banana ...
      (12 items omitted) (12 items omitted)
      ... grape
      ... guava


      How can I make it?







      text text-formatting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 13 '17 at 12:36









      Community

      1




      1










      asked Oct 23 '16 at 14:04









      Kevin DongKevin Dong

      4561613




      4561613




















          3 Answers
          3






          active

          oldest

          votes


















          7














          Using the -COLUMN or --columns=COLUMN option of pr



          -COLUMN, --columns=COLUMN
          output COLUMN columns and print columns down, unless -a is used.
          Balance number of lines in the columns on each page


          so either



          pr -t -2 yourfile


          or



          pr -t --columns=2 yourfile




          For example, augmenting your entries with some random dictionary words,



          $ cat << EOF | pr -t -2
          > apple
          > banana
          > `shuf -n28 /usr/share/dict/words`
          > grape
          > guava
          > EOF
          apple overachieves
          banana wickerwork
          cottonmouths supersonic
          adapter's draftiest
          boudoir's insisting
          cruised programs
          mousetrap parcel
          shticks basically
          TLC's coruscates
          conduction Jones
          geeing Ty
          gloamings bondage
          investing candelabra's
          radiotherapists Inchon's
          clasp's grape
          critters guava





          share|improve this answer























          • Great. It cannot choose indent using spaces, but this can be solved by expand.

            – Kevin Dong
            Oct 23 '16 at 17:31



















          6














          You can use the columns command from the autogen package, e.g.:



          columns -c 2 -w 40 --by-column < input


          For example:




          echo apple
          echo banana
          shuf -n28 /usr/share/dict/words
          echo grape
          echo guave
          |
          columns -w 40 -c 2 --by-columns


          Output:



          apple merwoman
          banana chiroplasty
          antispreading stylommatophorous
          spearmint Sphaerobolaceae
          sulphoxyphosphate snark
          nymphaeum reactionary
          ahluwalia hobo
          husky oxamethane
          crimeproof deltarium
          cerebrosis hematoporphyrin
          yoghurt noncompoundable
          colloquial sororially
          unaffirmed nonobjection
          saccharated reundercut
          thermochemic grape
          preobedience guave





          share|improve this answer
































            0














            Adding to Steeldriver's answer, if you have a requirement like mine, i.e. to print alternate words in same columns, use -a(across) option.



            [user@server ~]$ cat << EOF | pr -a -t -2
            > word1
            > word2
            > word3
            > word4
            > word5
            > word6
            > EOF
            word1 word2
            word3 word4
            word5 word6





            share|improve this answer























              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',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              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%2funix.stackexchange.com%2fquestions%2f318321%2fhow-can-i-wrap-text-into-two-columns%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              7














              Using the -COLUMN or --columns=COLUMN option of pr



              -COLUMN, --columns=COLUMN
              output COLUMN columns and print columns down, unless -a is used.
              Balance number of lines in the columns on each page


              so either



              pr -t -2 yourfile


              or



              pr -t --columns=2 yourfile




              For example, augmenting your entries with some random dictionary words,



              $ cat << EOF | pr -t -2
              > apple
              > banana
              > `shuf -n28 /usr/share/dict/words`
              > grape
              > guava
              > EOF
              apple overachieves
              banana wickerwork
              cottonmouths supersonic
              adapter's draftiest
              boudoir's insisting
              cruised programs
              mousetrap parcel
              shticks basically
              TLC's coruscates
              conduction Jones
              geeing Ty
              gloamings bondage
              investing candelabra's
              radiotherapists Inchon's
              clasp's grape
              critters guava





              share|improve this answer























              • Great. It cannot choose indent using spaces, but this can be solved by expand.

                – Kevin Dong
                Oct 23 '16 at 17:31
















              7














              Using the -COLUMN or --columns=COLUMN option of pr



              -COLUMN, --columns=COLUMN
              output COLUMN columns and print columns down, unless -a is used.
              Balance number of lines in the columns on each page


              so either



              pr -t -2 yourfile


              or



              pr -t --columns=2 yourfile




              For example, augmenting your entries with some random dictionary words,



              $ cat << EOF | pr -t -2
              > apple
              > banana
              > `shuf -n28 /usr/share/dict/words`
              > grape
              > guava
              > EOF
              apple overachieves
              banana wickerwork
              cottonmouths supersonic
              adapter's draftiest
              boudoir's insisting
              cruised programs
              mousetrap parcel
              shticks basically
              TLC's coruscates
              conduction Jones
              geeing Ty
              gloamings bondage
              investing candelabra's
              radiotherapists Inchon's
              clasp's grape
              critters guava





              share|improve this answer























              • Great. It cannot choose indent using spaces, but this can be solved by expand.

                – Kevin Dong
                Oct 23 '16 at 17:31














              7












              7








              7







              Using the -COLUMN or --columns=COLUMN option of pr



              -COLUMN, --columns=COLUMN
              output COLUMN columns and print columns down, unless -a is used.
              Balance number of lines in the columns on each page


              so either



              pr -t -2 yourfile


              or



              pr -t --columns=2 yourfile




              For example, augmenting your entries with some random dictionary words,



              $ cat << EOF | pr -t -2
              > apple
              > banana
              > `shuf -n28 /usr/share/dict/words`
              > grape
              > guava
              > EOF
              apple overachieves
              banana wickerwork
              cottonmouths supersonic
              adapter's draftiest
              boudoir's insisting
              cruised programs
              mousetrap parcel
              shticks basically
              TLC's coruscates
              conduction Jones
              geeing Ty
              gloamings bondage
              investing candelabra's
              radiotherapists Inchon's
              clasp's grape
              critters guava





              share|improve this answer













              Using the -COLUMN or --columns=COLUMN option of pr



              -COLUMN, --columns=COLUMN
              output COLUMN columns and print columns down, unless -a is used.
              Balance number of lines in the columns on each page


              so either



              pr -t -2 yourfile


              or



              pr -t --columns=2 yourfile




              For example, augmenting your entries with some random dictionary words,



              $ cat << EOF | pr -t -2
              > apple
              > banana
              > `shuf -n28 /usr/share/dict/words`
              > grape
              > guava
              > EOF
              apple overachieves
              banana wickerwork
              cottonmouths supersonic
              adapter's draftiest
              boudoir's insisting
              cruised programs
              mousetrap parcel
              shticks basically
              TLC's coruscates
              conduction Jones
              geeing Ty
              gloamings bondage
              investing candelabra's
              radiotherapists Inchon's
              clasp's grape
              critters guava






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 23 '16 at 17:05









              steeldriversteeldriver

              37.7k45389




              37.7k45389












              • Great. It cannot choose indent using spaces, but this can be solved by expand.

                – Kevin Dong
                Oct 23 '16 at 17:31


















              • Great. It cannot choose indent using spaces, but this can be solved by expand.

                – Kevin Dong
                Oct 23 '16 at 17:31

















              Great. It cannot choose indent using spaces, but this can be solved by expand.

              – Kevin Dong
              Oct 23 '16 at 17:31






              Great. It cannot choose indent using spaces, but this can be solved by expand.

              – Kevin Dong
              Oct 23 '16 at 17:31














              6














              You can use the columns command from the autogen package, e.g.:



              columns -c 2 -w 40 --by-column < input


              For example:




              echo apple
              echo banana
              shuf -n28 /usr/share/dict/words
              echo grape
              echo guave
              |
              columns -w 40 -c 2 --by-columns


              Output:



              apple merwoman
              banana chiroplasty
              antispreading stylommatophorous
              spearmint Sphaerobolaceae
              sulphoxyphosphate snark
              nymphaeum reactionary
              ahluwalia hobo
              husky oxamethane
              crimeproof deltarium
              cerebrosis hematoporphyrin
              yoghurt noncompoundable
              colloquial sororially
              unaffirmed nonobjection
              saccharated reundercut
              thermochemic grape
              preobedience guave





              share|improve this answer





























                6














                You can use the columns command from the autogen package, e.g.:



                columns -c 2 -w 40 --by-column < input


                For example:




                echo apple
                echo banana
                shuf -n28 /usr/share/dict/words
                echo grape
                echo guave
                |
                columns -w 40 -c 2 --by-columns


                Output:



                apple merwoman
                banana chiroplasty
                antispreading stylommatophorous
                spearmint Sphaerobolaceae
                sulphoxyphosphate snark
                nymphaeum reactionary
                ahluwalia hobo
                husky oxamethane
                crimeproof deltarium
                cerebrosis hematoporphyrin
                yoghurt noncompoundable
                colloquial sororially
                unaffirmed nonobjection
                saccharated reundercut
                thermochemic grape
                preobedience guave





                share|improve this answer



























                  6












                  6








                  6







                  You can use the columns command from the autogen package, e.g.:



                  columns -c 2 -w 40 --by-column < input


                  For example:




                  echo apple
                  echo banana
                  shuf -n28 /usr/share/dict/words
                  echo grape
                  echo guave
                  |
                  columns -w 40 -c 2 --by-columns


                  Output:



                  apple merwoman
                  banana chiroplasty
                  antispreading stylommatophorous
                  spearmint Sphaerobolaceae
                  sulphoxyphosphate snark
                  nymphaeum reactionary
                  ahluwalia hobo
                  husky oxamethane
                  crimeproof deltarium
                  cerebrosis hematoporphyrin
                  yoghurt noncompoundable
                  colloquial sororially
                  unaffirmed nonobjection
                  saccharated reundercut
                  thermochemic grape
                  preobedience guave





                  share|improve this answer















                  You can use the columns command from the autogen package, e.g.:



                  columns -c 2 -w 40 --by-column < input


                  For example:




                  echo apple
                  echo banana
                  shuf -n28 /usr/share/dict/words
                  echo grape
                  echo guave
                  |
                  columns -w 40 -c 2 --by-columns


                  Output:



                  apple merwoman
                  banana chiroplasty
                  antispreading stylommatophorous
                  spearmint Sphaerobolaceae
                  sulphoxyphosphate snark
                  nymphaeum reactionary
                  ahluwalia hobo
                  husky oxamethane
                  crimeproof deltarium
                  cerebrosis hematoporphyrin
                  yoghurt noncompoundable
                  colloquial sororially
                  unaffirmed nonobjection
                  saccharated reundercut
                  thermochemic grape
                  preobedience guave






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 24 '16 at 22:30

























                  answered Oct 23 '16 at 14:45









                  ThorThor

                  12.2k13762




                  12.2k13762





















                      0














                      Adding to Steeldriver's answer, if you have a requirement like mine, i.e. to print alternate words in same columns, use -a(across) option.



                      [user@server ~]$ cat << EOF | pr -a -t -2
                      > word1
                      > word2
                      > word3
                      > word4
                      > word5
                      > word6
                      > EOF
                      word1 word2
                      word3 word4
                      word5 word6





                      share|improve this answer



























                        0














                        Adding to Steeldriver's answer, if you have a requirement like mine, i.e. to print alternate words in same columns, use -a(across) option.



                        [user@server ~]$ cat << EOF | pr -a -t -2
                        > word1
                        > word2
                        > word3
                        > word4
                        > word5
                        > word6
                        > EOF
                        word1 word2
                        word3 word4
                        word5 word6





                        share|improve this answer

























                          0












                          0








                          0







                          Adding to Steeldriver's answer, if you have a requirement like mine, i.e. to print alternate words in same columns, use -a(across) option.



                          [user@server ~]$ cat << EOF | pr -a -t -2
                          > word1
                          > word2
                          > word3
                          > word4
                          > word5
                          > word6
                          > EOF
                          word1 word2
                          word3 word4
                          word5 word6





                          share|improve this answer













                          Adding to Steeldriver's answer, if you have a requirement like mine, i.e. to print alternate words in same columns, use -a(across) option.



                          [user@server ~]$ cat << EOF | pr -a -t -2
                          > word1
                          > word2
                          > word3
                          > word4
                          > word5
                          > word6
                          > EOF
                          word1 word2
                          word3 word4
                          word5 word6






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 14 at 7:06









                          Goutham RajGoutham Raj

                          1




                          1



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • 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%2funix.stackexchange.com%2fquestions%2f318321%2fhow-can-i-wrap-text-into-two-columns%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

                              Peggy Mitchell

                              The Forum (Inglewood, California)

                              Palaiologos