adding a new line character to a row

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











up vote
1
down vote

favorite












I'd like to extract the 2nd field and transpose it to become a row



cat > temp1
1 73
2 74
3 75


My approach :



cut -f2 temp1 | tr 'n' 't' > temp2


The result :



temp2
73 74 75


Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?










share|improve this question

























    up vote
    1
    down vote

    favorite












    I'd like to extract the 2nd field and transpose it to become a row



    cat > temp1
    1 73
    2 74
    3 75


    My approach :



    cut -f2 temp1 | tr 'n' 't' > temp2


    The result :



    temp2
    73 74 75


    Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?










    share|improve this question























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I'd like to extract the 2nd field and transpose it to become a row



      cat > temp1
      1 73
      2 74
      3 75


      My approach :



      cut -f2 temp1 | tr 'n' 't' > temp2


      The result :



      temp2
      73 74 75


      Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?










      share|improve this question













      I'd like to extract the 2nd field and transpose it to become a row



      cat > temp1
      1 73
      2 74
      3 75


      My approach :



      cut -f2 temp1 | tr 'n' 't' > temp2


      The result :



      temp2
      73 74 75


      Understandably, there is a tab separator at the right end of the line but missing a new line character. Is there an simple one-liner to fix this?







      shell awk sed grep tr






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 25 mins ago









      Aron

      63




      63




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Use paste instead of tr:



          $ cut -f2 temp1 | paste -s
          73 74 75


          verifying the invisible whitespace



          $ cut -f2 temp1 | paste -s | od -c
          0000000 7 3 t 7 4 t 7 5 n
          0000011




          share




















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



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474646%2fadding-a-new-line-character-to-a-row%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
            0
            down vote













            Use paste instead of tr:



            $ cut -f2 temp1 | paste -s
            73 74 75


            verifying the invisible whitespace



            $ cut -f2 temp1 | paste -s | od -c
            0000000 7 3 t 7 4 t 7 5 n
            0000011




            share
























              up vote
              0
              down vote













              Use paste instead of tr:



              $ cut -f2 temp1 | paste -s
              73 74 75


              verifying the invisible whitespace



              $ cut -f2 temp1 | paste -s | od -c
              0000000 7 3 t 7 4 t 7 5 n
              0000011




              share






















                up vote
                0
                down vote










                up vote
                0
                down vote









                Use paste instead of tr:



                $ cut -f2 temp1 | paste -s
                73 74 75


                verifying the invisible whitespace



                $ cut -f2 temp1 | paste -s | od -c
                0000000 7 3 t 7 4 t 7 5 n
                0000011




                share












                Use paste instead of tr:



                $ cut -f2 temp1 | paste -s
                73 74 75


                verifying the invisible whitespace



                $ cut -f2 temp1 | paste -s | od -c
                0000000 7 3 t 7 4 t 7 5 n
                0000011





                share











                share


                share










                answered 2 mins ago









                glenn jackman

                48.6k366105




                48.6k366105



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474646%2fadding-a-new-line-character-to-a-row%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?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?