Display lines when the digits repeated in same line

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











up vote
0
down vote

favorite












I would like to display the lines on text if 3 digits repeated in same line



with a condition applied for 3 digits repeat.



Input



410202410
203103903
555710294473555


so 410 and 555 repeated



Output



410202410
555710294473555


how to handle this through sed or awk?



And kindly advise in case if i would like to apply the same only on digits before first comma



such as 410202410,11,2017,109







share|improve this question


























    up vote
    0
    down vote

    favorite












    I would like to display the lines on text if 3 digits repeated in same line



    with a condition applied for 3 digits repeat.



    Input



    410202410
    203103903
    555710294473555


    so 410 and 555 repeated



    Output



    410202410
    555710294473555


    how to handle this through sed or awk?



    And kindly advise in case if i would like to apply the same only on digits before first comma



    such as 410202410,11,2017,109







    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I would like to display the lines on text if 3 digits repeated in same line



      with a condition applied for 3 digits repeat.



      Input



      410202410
      203103903
      555710294473555


      so 410 and 555 repeated



      Output



      410202410
      555710294473555


      how to handle this through sed or awk?



      And kindly advise in case if i would like to apply the same only on digits before first comma



      such as 410202410,11,2017,109







      share|improve this question














      I would like to display the lines on text if 3 digits repeated in same line



      with a condition applied for 3 digits repeat.



      Input



      410202410
      203103903
      555710294473555


      so 410 and 555 repeated



      Output



      410202410
      555710294473555


      how to handle this through sed or awk?



      And kindly advise in case if i would like to apply the same only on digits before first comma



      such as 410202410,11,2017,109









      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 15 '17 at 22:13

























      asked Dec 15 '17 at 21:38









      αԋɱҽԃ αмєяιcαη

      412418




      412418




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          POSIXly:



          grep '([0-9]3).*1'


          Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.



          To restrict that pattern before the first comma:



          grep '^[^,]*([0-9]3)[^,]*1'





          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%2f411146%2fdisplay-lines-when-the-digits-repeated-in-same-line%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
            2
            down vote



            accepted










            POSIXly:



            grep '([0-9]3).*1'


            Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.



            To restrict that pattern before the first comma:



            grep '^[^,]*([0-9]3)[^,]*1'





            share|improve this answer
























              up vote
              2
              down vote



              accepted










              POSIXly:



              grep '([0-9]3).*1'


              Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.



              To restrict that pattern before the first comma:



              grep '^[^,]*([0-9]3)[^,]*1'





              share|improve this answer






















                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                POSIXly:



                grep '([0-9]3).*1'


                Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.



                To restrict that pattern before the first comma:



                grep '^[^,]*([0-9]3)[^,]*1'





                share|improve this answer












                POSIXly:



                grep '([0-9]3).*1'


                Would print the lines that contain 3 decimal digits followed by a sequence of 0 or more characters followed by the same 3 digits.



                To restrict that pattern before the first comma:



                grep '^[^,]*([0-9]3)[^,]*1'






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 15 '17 at 22:07









                Stéphane Chazelas

                282k53520854




                282k53520854






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f411146%2fdisplay-lines-when-the-digits-repeated-in-same-line%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)