Match file names with prefix, few digits and a suffix regex












0















How do I match file names abc_NNN.xyz? here is the directory content



[root@ tmp]# ls -ltr
total 0
-rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:43 abc_def_123.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_234.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_345.xyz
-rw-r--r--. 1 root root 0 Jan 3 01:57 abc_123_123.xyz
-rw-r--r--. 1 root root 0 Jan 3 01:57 abc_234_234.xyz
-rw-r--r--. 1 root root 0 Jan 3 01:57 abc_345_345.xyz


This one works for me



[root@ tmp]# ls -ltr abc_[0-9][0-9][0-9].xyz
-rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
-rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz


The problem is that in the real scenario I need to match abc_NNNNNNNNN.xyz so the expression is too large. I am looking for something similar to abc_[0-9]{3}.xyz, abc_[0-9]+3.xyz (obviously these doesn't work)










share|improve this question





























    0















    How do I match file names abc_NNN.xyz? here is the directory content



    [root@ tmp]# ls -ltr
    total 0
    -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:43 abc_def_123.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_234.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_345.xyz
    -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_123_123.xyz
    -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_234_234.xyz
    -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_345_345.xyz


    This one works for me



    [root@ tmp]# ls -ltr abc_[0-9][0-9][0-9].xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
    -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz


    The problem is that in the real scenario I need to match abc_NNNNNNNNN.xyz so the expression is too large. I am looking for something similar to abc_[0-9]{3}.xyz, abc_[0-9]+3.xyz (obviously these doesn't work)










    share|improve this question



























      0












      0








      0


      0






      How do I match file names abc_NNN.xyz? here is the directory content



      [root@ tmp]# ls -ltr
      total 0
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:43 abc_def_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_345.xyz
      -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_123_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_234_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_345_345.xyz


      This one works for me



      [root@ tmp]# ls -ltr abc_[0-9][0-9][0-9].xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz


      The problem is that in the real scenario I need to match abc_NNNNNNNNN.xyz so the expression is too large. I am looking for something similar to abc_[0-9]{3}.xyz, abc_[0-9]+3.xyz (obviously these doesn't work)










      share|improve this question
















      How do I match file names abc_NNN.xyz? here is the directory content



      [root@ tmp]# ls -ltr
      total 0
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:43 abc_def_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:44 abc_def_345.xyz
      -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_123_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_234_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 01:57 abc_345_345.xyz


      This one works for me



      [root@ tmp]# ls -ltr abc_[0-9][0-9][0-9].xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_123.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_234.xyz
      -rw-r--r--. 1 root root 0 Jan 3 00:42 abc_345.xyz


      The problem is that in the real scenario I need to match abc_NNNNNNNNN.xyz so the expression is too large. I am looking for something similar to abc_[0-9]{3}.xyz, abc_[0-9]+3.xyz (obviously these doesn't work)







      regular-expression ls






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 7:02







      e271p314

















      asked Jan 3 at 5:59









      e271p314e271p314

      19929




      19929






















          3 Answers
          3






          active

          oldest

          votes


















          2














          For the original simpler examples you listed, abc_[0-9]*.xyz will work. That obviously will match some things other than numbers, but will exclude the def files you've listed as the first character after the first underscore is not a digit in those cases.



          For the more complicated examples, it's probably time to deploy find so we can actually use regular expressions:



          $ ls
          abc_123_123.xyz abc_123.xyz abc_234_234.xyz abc_234.xyz abc_345_345.xyz abc_345.xyz abc_def_123.xyz abc_def_234.xyz abc_def_345.xyz
          $ find . -regex './abc_[0-9]+.xyz'
          ./abc_345.xyz
          ./abc_234.xyz
          ./abc_123.xyz


          That's with GNU find, other variants may differ slightly.






          share|improve this answer


























          • I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

            – e271p314
            Jan 3 at 7:03











          • Updated to use a proper regex tool :-)

            – Philip Kendall
            Jan 3 at 7:27











          • Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

            – e271p314
            Jan 3 at 12:25



















          3














          If you're using bash, you could also make use of its extended globbing capabilites:



          shopt -s extglob
          ls abc_+([0-9]).xyz


          Sample uutput:



          abc_123456.xyz
          abc_123.xyz
          abc_1.xyz
          abc_3456.xyz
          abc_345.xyz
          abc_56789.xyz
          abc_567.xyz


          The +([0-9]) expression matches one or more instances of any digit. This which will match the 'NNNN' pattern of any length.






          share|improve this answer
























          • I'm not sure about shopt -s extglob, how standard is that?

            – e271p314
            Jan 3 at 11:33











          • @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

            – Haxiel
            Jan 3 at 11:46











          • I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

            – e271p314
            Jan 3 at 11:51





















          1














          As mentioned in POSIX glob — how to match one-or-more [:digit:] shell globing is not equal to regex. You are probably best of processing the ls output with grep in which case your originally mentioned abc_[0-9]{3}.xyz pattern would work.



          You can combine the two as such:



          [root@ tmp]# ls -ltr abc_[0-9]+.xyz | grep abc_[0-9]{3}.xyz





          share|improve this answer
























          • Please don't try and parse the output of ls.

            – Philip Kendall
            Jan 3 at 7:17











          • Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

            – e271p314
            Jan 3 at 11:28











          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%2f492166%2fmatch-file-names-with-prefix-few-digits-and-a-suffix-regex%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









          2














          For the original simpler examples you listed, abc_[0-9]*.xyz will work. That obviously will match some things other than numbers, but will exclude the def files you've listed as the first character after the first underscore is not a digit in those cases.



          For the more complicated examples, it's probably time to deploy find so we can actually use regular expressions:



          $ ls
          abc_123_123.xyz abc_123.xyz abc_234_234.xyz abc_234.xyz abc_345_345.xyz abc_345.xyz abc_def_123.xyz abc_def_234.xyz abc_def_345.xyz
          $ find . -regex './abc_[0-9]+.xyz'
          ./abc_345.xyz
          ./abc_234.xyz
          ./abc_123.xyz


          That's with GNU find, other variants may differ slightly.






          share|improve this answer


























          • I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

            – e271p314
            Jan 3 at 7:03











          • Updated to use a proper regex tool :-)

            – Philip Kendall
            Jan 3 at 7:27











          • Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

            – e271p314
            Jan 3 at 12:25
















          2














          For the original simpler examples you listed, abc_[0-9]*.xyz will work. That obviously will match some things other than numbers, but will exclude the def files you've listed as the first character after the first underscore is not a digit in those cases.



          For the more complicated examples, it's probably time to deploy find so we can actually use regular expressions:



          $ ls
          abc_123_123.xyz abc_123.xyz abc_234_234.xyz abc_234.xyz abc_345_345.xyz abc_345.xyz abc_def_123.xyz abc_def_234.xyz abc_def_345.xyz
          $ find . -regex './abc_[0-9]+.xyz'
          ./abc_345.xyz
          ./abc_234.xyz
          ./abc_123.xyz


          That's with GNU find, other variants may differ slightly.






          share|improve this answer


























          • I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

            – e271p314
            Jan 3 at 7:03











          • Updated to use a proper regex tool :-)

            – Philip Kendall
            Jan 3 at 7:27











          • Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

            – e271p314
            Jan 3 at 12:25














          2












          2








          2







          For the original simpler examples you listed, abc_[0-9]*.xyz will work. That obviously will match some things other than numbers, but will exclude the def files you've listed as the first character after the first underscore is not a digit in those cases.



          For the more complicated examples, it's probably time to deploy find so we can actually use regular expressions:



          $ ls
          abc_123_123.xyz abc_123.xyz abc_234_234.xyz abc_234.xyz abc_345_345.xyz abc_345.xyz abc_def_123.xyz abc_def_234.xyz abc_def_345.xyz
          $ find . -regex './abc_[0-9]+.xyz'
          ./abc_345.xyz
          ./abc_234.xyz
          ./abc_123.xyz


          That's with GNU find, other variants may differ slightly.






          share|improve this answer















          For the original simpler examples you listed, abc_[0-9]*.xyz will work. That obviously will match some things other than numbers, but will exclude the def files you've listed as the first character after the first underscore is not a digit in those cases.



          For the more complicated examples, it's probably time to deploy find so we can actually use regular expressions:



          $ ls
          abc_123_123.xyz abc_123.xyz abc_234_234.xyz abc_234.xyz abc_345_345.xyz abc_345.xyz abc_def_123.xyz abc_def_234.xyz abc_def_345.xyz
          $ find . -regex './abc_[0-9]+.xyz'
          ./abc_345.xyz
          ./abc_234.xyz
          ./abc_123.xyz


          That's with GNU find, other variants may differ slightly.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 3 at 7:27

























          answered Jan 3 at 6:16









          Philip KendallPhilip Kendall

          53938




          53938













          • I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

            – e271p314
            Jan 3 at 7:03











          • Updated to use a proper regex tool :-)

            – Philip Kendall
            Jan 3 at 7:27











          • Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

            – e271p314
            Jan 3 at 12:25



















          • I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

            – e271p314
            Jan 3 at 7:03











          • Updated to use a proper regex tool :-)

            – Philip Kendall
            Jan 3 at 7:27











          • Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

            – e271p314
            Jan 3 at 12:25

















          I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

          – e271p314
          Jan 3 at 7:03





          I updated the question, the directory has abc_NNN_NNN.xyz file names too, I want to match only abc_NNN.xyz

          – e271p314
          Jan 3 at 7:03













          Updated to use a proper regex tool :-)

          – Philip Kendall
          Jan 3 at 7:27





          Updated to use a proper regex tool :-)

          – Philip Kendall
          Jan 3 at 7:27













          Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

          – e271p314
          Jan 3 at 12:25





          Worked for the actual use case I was aiming for too, I just had to run the find results through sort but other than that your solution is the closet to what I was looking for

          – e271p314
          Jan 3 at 12:25













          3














          If you're using bash, you could also make use of its extended globbing capabilites:



          shopt -s extglob
          ls abc_+([0-9]).xyz


          Sample uutput:



          abc_123456.xyz
          abc_123.xyz
          abc_1.xyz
          abc_3456.xyz
          abc_345.xyz
          abc_56789.xyz
          abc_567.xyz


          The +([0-9]) expression matches one or more instances of any digit. This which will match the 'NNNN' pattern of any length.






          share|improve this answer
























          • I'm not sure about shopt -s extglob, how standard is that?

            – e271p314
            Jan 3 at 11:33











          • @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

            – Haxiel
            Jan 3 at 11:46











          • I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

            – e271p314
            Jan 3 at 11:51


















          3














          If you're using bash, you could also make use of its extended globbing capabilites:



          shopt -s extglob
          ls abc_+([0-9]).xyz


          Sample uutput:



          abc_123456.xyz
          abc_123.xyz
          abc_1.xyz
          abc_3456.xyz
          abc_345.xyz
          abc_56789.xyz
          abc_567.xyz


          The +([0-9]) expression matches one or more instances of any digit. This which will match the 'NNNN' pattern of any length.






          share|improve this answer
























          • I'm not sure about shopt -s extglob, how standard is that?

            – e271p314
            Jan 3 at 11:33











          • @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

            – Haxiel
            Jan 3 at 11:46











          • I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

            – e271p314
            Jan 3 at 11:51
















          3












          3








          3







          If you're using bash, you could also make use of its extended globbing capabilites:



          shopt -s extglob
          ls abc_+([0-9]).xyz


          Sample uutput:



          abc_123456.xyz
          abc_123.xyz
          abc_1.xyz
          abc_3456.xyz
          abc_345.xyz
          abc_56789.xyz
          abc_567.xyz


          The +([0-9]) expression matches one or more instances of any digit. This which will match the 'NNNN' pattern of any length.






          share|improve this answer













          If you're using bash, you could also make use of its extended globbing capabilites:



          shopt -s extglob
          ls abc_+([0-9]).xyz


          Sample uutput:



          abc_123456.xyz
          abc_123.xyz
          abc_1.xyz
          abc_3456.xyz
          abc_345.xyz
          abc_56789.xyz
          abc_567.xyz


          The +([0-9]) expression matches one or more instances of any digit. This which will match the 'NNNN' pattern of any length.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 8:12









          HaxielHaxiel

          1,562410




          1,562410













          • I'm not sure about shopt -s extglob, how standard is that?

            – e271p314
            Jan 3 at 11:33











          • @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

            – Haxiel
            Jan 3 at 11:46











          • I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

            – e271p314
            Jan 3 at 11:51





















          • I'm not sure about shopt -s extglob, how standard is that?

            – e271p314
            Jan 3 at 11:33











          • @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

            – Haxiel
            Jan 3 at 11:46











          • I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

            – e271p314
            Jan 3 at 11:51



















          I'm not sure about shopt -s extglob, how standard is that?

          – e271p314
          Jan 3 at 11:33





          I'm not sure about shopt -s extglob, how standard is that?

          – e271p314
          Jan 3 at 11:33













          @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

          – Haxiel
          Jan 3 at 11:46





          @e271p314 It's a shell option that's built into bash. Ksh also has a similar extended globbing option, but the syntax may be slightly different.

          – Haxiel
          Jan 3 at 11:46













          I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

          – e271p314
          Jan 3 at 11:51







          I confirm it worked for me, first time I hear about shopt -s extglob, thanks for letting me know

          – e271p314
          Jan 3 at 11:51













          1














          As mentioned in POSIX glob — how to match one-or-more [:digit:] shell globing is not equal to regex. You are probably best of processing the ls output with grep in which case your originally mentioned abc_[0-9]{3}.xyz pattern would work.



          You can combine the two as such:



          [root@ tmp]# ls -ltr abc_[0-9]+.xyz | grep abc_[0-9]{3}.xyz





          share|improve this answer
























          • Please don't try and parse the output of ls.

            – Philip Kendall
            Jan 3 at 7:17











          • Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

            – e271p314
            Jan 3 at 11:28
















          1














          As mentioned in POSIX glob — how to match one-or-more [:digit:] shell globing is not equal to regex. You are probably best of processing the ls output with grep in which case your originally mentioned abc_[0-9]{3}.xyz pattern would work.



          You can combine the two as such:



          [root@ tmp]# ls -ltr abc_[0-9]+.xyz | grep abc_[0-9]{3}.xyz





          share|improve this answer
























          • Please don't try and parse the output of ls.

            – Philip Kendall
            Jan 3 at 7:17











          • Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

            – e271p314
            Jan 3 at 11:28














          1












          1








          1







          As mentioned in POSIX glob — how to match one-or-more [:digit:] shell globing is not equal to regex. You are probably best of processing the ls output with grep in which case your originally mentioned abc_[0-9]{3}.xyz pattern would work.



          You can combine the two as such:



          [root@ tmp]# ls -ltr abc_[0-9]+.xyz | grep abc_[0-9]{3}.xyz





          share|improve this answer













          As mentioned in POSIX glob — how to match one-or-more [:digit:] shell globing is not equal to regex. You are probably best of processing the ls output with grep in which case your originally mentioned abc_[0-9]{3}.xyz pattern would work.



          You can combine the two as such:



          [root@ tmp]# ls -ltr abc_[0-9]+.xyz | grep abc_[0-9]{3}.xyz






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 6:27









          Eliezer PEliezer P

          134




          134













          • Please don't try and parse the output of ls.

            – Philip Kendall
            Jan 3 at 7:17











          • Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

            – e271p314
            Jan 3 at 11:28



















          • Please don't try and parse the output of ls.

            – Philip Kendall
            Jan 3 at 7:17











          • Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

            – e271p314
            Jan 3 at 11:28

















          Please don't try and parse the output of ls.

          – Philip Kendall
          Jan 3 at 7:17





          Please don't try and parse the output of ls.

          – Philip Kendall
          Jan 3 at 7:17













          Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

          – e271p314
          Jan 3 at 11:28





          Didn't work, with ls -ltr abc_[0-9]+.xyz no files match, with ls -ltr abc_[0-9]*.xyz files match but when I pipe it through grep abc_[0-9]{3}.xyz I get no results

          – e271p314
          Jan 3 at 11:28


















          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%2f492166%2fmatch-file-names-with-prefix-few-digits-and-a-suffix-regex%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

          Morgemoulin

          Scott Moir

          Souastre