Regex that matches only dirnames with integers and dots

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











up vote
0
down vote

favorite












Trying to write -regex for a find statement that shows only directories with dots and numbers, for example 1.2.3.4 oraz 1.2.3 or 1.3.4.5.6 was trying something like "-regex '.[0-9.]+'", but it also shows dirs with letters. And I only want directories with numbers and dots.







share|improve this question


























    up vote
    0
    down vote

    favorite












    Trying to write -regex for a find statement that shows only directories with dots and numbers, for example 1.2.3.4 oraz 1.2.3 or 1.3.4.5.6 was trying something like "-regex '.[0-9.]+'", but it also shows dirs with letters. And I only want directories with numbers and dots.







    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Trying to write -regex for a find statement that shows only directories with dots and numbers, for example 1.2.3.4 oraz 1.2.3 or 1.3.4.5.6 was trying something like "-regex '.[0-9.]+'", but it also shows dirs with letters. And I only want directories with numbers and dots.







      share|improve this question














      Trying to write -regex for a find statement that shows only directories with dots and numbers, for example 1.2.3.4 oraz 1.2.3 or 1.3.4.5.6 was trying something like "-regex '.[0-9.]+'", but it also shows dirs with letters. And I only want directories with numbers and dots.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '17 at 15:25

























      asked Nov 12 '17 at 15:02









      harcotlupus

      686




      686




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          -regex matches the whole path:



          find /path -type d -regex ".*/[0-9.]+"





          share|improve this answer




















          • But doesn't it allows letters on other positions?
            – harcotlupus
            Nov 12 '17 at 15:11










          • You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
            – dessert
            Nov 12 '17 at 15:14











          • It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
            – harcotlupus
            Nov 12 '17 at 15:30











          • Sorry, I've eddited last comment :)
            – harcotlupus
            Nov 12 '17 at 15:32










          • Your code is working, don't know why in first place it didn't worked
            – harcotlupus
            Nov 12 '17 at 16:15

















          up vote
          0
          down vote













          Standardly:



          LC_ALL=C find /path ! -name '*[!0-9.]*' -type d


          That is, list files of type directory whose name doesn't not contain a character other than decimal digit or ..






          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%2f404051%2fregex-that-matches-only-dirnames-with-integers-and-dots%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
            1
            down vote



            accepted










            -regex matches the whole path:



            find /path -type d -regex ".*/[0-9.]+"





            share|improve this answer




















            • But doesn't it allows letters on other positions?
              – harcotlupus
              Nov 12 '17 at 15:11










            • You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
              – dessert
              Nov 12 '17 at 15:14











            • It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
              – harcotlupus
              Nov 12 '17 at 15:30











            • Sorry, I've eddited last comment :)
              – harcotlupus
              Nov 12 '17 at 15:32










            • Your code is working, don't know why in first place it didn't worked
              – harcotlupus
              Nov 12 '17 at 16:15














            up vote
            1
            down vote



            accepted










            -regex matches the whole path:



            find /path -type d -regex ".*/[0-9.]+"





            share|improve this answer




















            • But doesn't it allows letters on other positions?
              – harcotlupus
              Nov 12 '17 at 15:11










            • You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
              – dessert
              Nov 12 '17 at 15:14











            • It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
              – harcotlupus
              Nov 12 '17 at 15:30











            • Sorry, I've eddited last comment :)
              – harcotlupus
              Nov 12 '17 at 15:32










            • Your code is working, don't know why in first place it didn't worked
              – harcotlupus
              Nov 12 '17 at 16:15












            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            -regex matches the whole path:



            find /path -type d -regex ".*/[0-9.]+"





            share|improve this answer












            -regex matches the whole path:



            find /path -type d -regex ".*/[0-9.]+"






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 12 '17 at 15:09









            dessert

            1,013321




            1,013321











            • But doesn't it allows letters on other positions?
              – harcotlupus
              Nov 12 '17 at 15:11










            • You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
              – dessert
              Nov 12 '17 at 15:14











            • It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
              – harcotlupus
              Nov 12 '17 at 15:30











            • Sorry, I've eddited last comment :)
              – harcotlupus
              Nov 12 '17 at 15:32










            • Your code is working, don't know why in first place it didn't worked
              – harcotlupus
              Nov 12 '17 at 16:15
















            • But doesn't it allows letters on other positions?
              – harcotlupus
              Nov 12 '17 at 15:11










            • You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
              – dessert
              Nov 12 '17 at 15:14











            • It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
              – harcotlupus
              Nov 12 '17 at 15:30











            • Sorry, I've eddited last comment :)
              – harcotlupus
              Nov 12 '17 at 15:32










            • Your code is working, don't know why in first place it didn't worked
              – harcotlupus
              Nov 12 '17 at 16:15















            But doesn't it allows letters on other positions?
            – harcotlupus
            Nov 12 '17 at 15:11




            But doesn't it allows letters on other positions?
            – harcotlupus
            Nov 12 '17 at 15:11












            You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
            – dessert
            Nov 12 '17 at 15:14





            You mean inside the path? Yes, this will find any directory which has only [0-9.] in its name, regardless of the path. If you want to match [0-9.] in the whole path use -regex "[0-9./]+" instead.
            – dessert
            Nov 12 '17 at 15:14













            It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
            – harcotlupus
            Nov 12 '17 at 15:30





            It's like, I have directory which contains other directories for example something.txt something2.txt 1.2.3.4 5.6.8 4.3.2 and I want to show only those which contains only numbers and dots But both answers show's me also directories with characters...
            – harcotlupus
            Nov 12 '17 at 15:30













            Sorry, I've eddited last comment :)
            – harcotlupus
            Nov 12 '17 at 15:32




            Sorry, I've eddited last comment :)
            – harcotlupus
            Nov 12 '17 at 15:32












            Your code is working, don't know why in first place it didn't worked
            – harcotlupus
            Nov 12 '17 at 16:15




            Your code is working, don't know why in first place it didn't worked
            – harcotlupus
            Nov 12 '17 at 16:15












            up vote
            0
            down vote













            Standardly:



            LC_ALL=C find /path ! -name '*[!0-9.]*' -type d


            That is, list files of type directory whose name doesn't not contain a character other than decimal digit or ..






            share|improve this answer
























              up vote
              0
              down vote













              Standardly:



              LC_ALL=C find /path ! -name '*[!0-9.]*' -type d


              That is, list files of type directory whose name doesn't not contain a character other than decimal digit or ..






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                Standardly:



                LC_ALL=C find /path ! -name '*[!0-9.]*' -type d


                That is, list files of type directory whose name doesn't not contain a character other than decimal digit or ..






                share|improve this answer












                Standardly:



                LC_ALL=C find /path ! -name '*[!0-9.]*' -type d


                That is, list files of type directory whose name doesn't not contain a character other than decimal digit or ..







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 23 at 15:10









                Stéphane Chazelas

                283k53521854




                283k53521854



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f404051%2fregex-that-matches-only-dirnames-with-integers-and-dots%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)