remove comma from a specific portion of a long string

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











up vote
4
down vote

favorite












I have document contain very long strings represent decoded information, i want to remove , commas from the last portion of the string. For example this is one of the long strings:



 Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


I want to remove comma from the last portion of it so let me zoom in to show you how it look like:



(99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


so the final result look like this:



Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:



(99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!










share|improve this question



























    up vote
    4
    down vote

    favorite












    I have document contain very long strings represent decoded information, i want to remove , commas from the last portion of the string. For example this is one of the long strings:



     Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


    I want to remove comma from the last portion of it so let me zoom in to show you how it look like:



    (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


    so the final result look like this:



    Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


    please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:



    (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


    I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!










    share|improve this question

























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      I have document contain very long strings represent decoded information, i want to remove , commas from the last portion of the string. For example this is one of the long strings:



       Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


      I want to remove comma from the last portion of it so let me zoom in to show you how it look like:



      (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


      so the final result look like this:



      Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


      please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:



      (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


      I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!










      share|improve this question















      I have document contain very long strings represent decoded information, i want to remove , commas from the last portion of the string. For example this is one of the long strings:



       Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


      I want to remove comma from the last portion of it so let me zoom in to show you how it look like:



      (99990987868959,null,68,'T59 - %,Dsc,Itm-2 tax 1 Juris',4,5);


      so the final result look like this:



      Insert into PE_ATRT_S(ID_ANA_TX,FQ_WQ_ASDF,ID_PRTY,NM_ATHY_TX,SC_RND,QU_DGT_RND) values (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


      please notice the last portion of the long string, no comma in part of it let's zoom in to see it better:



      (99990987868959,null,68,'T59 - % Dsc Itm-2 tax 1 Juris',4,5);


      I spent hours trying to find a way to do it but I failed, would you please help me to fix these strings, thanks!







      text-processing






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 54 mins ago









      Jeff Schaller

      33.8k851113




      33.8k851113










      asked 1 hour ago









      Zahi

      171111




      171111




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          4
          down vote



          accepted










          awk -F' -vOFS=' 'gsub(","," ",$2); print'





          share|improve this answer




















          • Nice solution. Just one bug : it will work only with lines having one '...,...' field.
            – George Vasiliou
            22 mins ago


















          up vote
          2
          down vote













          Alternative solution with gnu sed:



          sed -r 's/(x27.*),(.*x27)/1 2/g' file


          x27 : ascii code of single quote '






          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',
            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%2f474357%2fremove-comma-from-a-specific-portion-of-a-long-string%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            4
            down vote



            accepted










            awk -F' -vOFS=' 'gsub(","," ",$2); print'





            share|improve this answer




















            • Nice solution. Just one bug : it will work only with lines having one '...,...' field.
              – George Vasiliou
              22 mins ago















            up vote
            4
            down vote



            accepted










            awk -F' -vOFS=' 'gsub(","," ",$2); print'





            share|improve this answer




















            • Nice solution. Just one bug : it will work only with lines having one '...,...' field.
              – George Vasiliou
              22 mins ago













            up vote
            4
            down vote



            accepted







            up vote
            4
            down vote



            accepted






            awk -F' -vOFS=' 'gsub(","," ",$2); print'





            share|improve this answer












            awk -F' -vOFS=' 'gsub(","," ",$2); print'






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 1 hour ago









            Goro

            7,94153777




            7,94153777











            • Nice solution. Just one bug : it will work only with lines having one '...,...' field.
              – George Vasiliou
              22 mins ago

















            • Nice solution. Just one bug : it will work only with lines having one '...,...' field.
              – George Vasiliou
              22 mins ago
















            Nice solution. Just one bug : it will work only with lines having one '...,...' field.
            – George Vasiliou
            22 mins ago





            Nice solution. Just one bug : it will work only with lines having one '...,...' field.
            – George Vasiliou
            22 mins ago













            up vote
            2
            down vote













            Alternative solution with gnu sed:



            sed -r 's/(x27.*),(.*x27)/1 2/g' file


            x27 : ascii code of single quote '






            share|improve this answer
























              up vote
              2
              down vote













              Alternative solution with gnu sed:



              sed -r 's/(x27.*),(.*x27)/1 2/g' file


              x27 : ascii code of single quote '






              share|improve this answer






















                up vote
                2
                down vote










                up vote
                2
                down vote









                Alternative solution with gnu sed:



                sed -r 's/(x27.*),(.*x27)/1 2/g' file


                x27 : ascii code of single quote '






                share|improve this answer












                Alternative solution with gnu sed:



                sed -r 's/(x27.*),(.*x27)/1 2/g' file


                x27 : ascii code of single quote '







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 15 mins ago









                George Vasiliou

                5,34031027




                5,34031027



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474357%2fremove-comma-from-a-specific-portion-of-a-long-string%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    Long meetings (6-7 hours a day): Being “babysat” by supervisor

                    Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                    Confectionery