How to list only the file names of the same type in the directory?

Multi tool use
Multi tool use

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











up vote
0
down vote

favorite












I have two groups of files in the same directory *fmb and *fmx.



I want to learn how to print only the file name of fmb files, file1.fmb, file2.fmb, file3.fmb will be printed as file1, file2, file3.










share|improve this question



























    up vote
    0
    down vote

    favorite












    I have two groups of files in the same directory *fmb and *fmx.



    I want to learn how to print only the file name of fmb files, file1.fmb, file2.fmb, file3.fmb will be printed as file1, file2, file3.










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have two groups of files in the same directory *fmb and *fmx.



      I want to learn how to print only the file name of fmb files, file1.fmb, file2.fmb, file3.fmb will be printed as file1, file2, file3.










      share|improve this question















      I have two groups of files in the same directory *fmb and *fmx.



      I want to learn how to print only the file name of fmb files, file1.fmb, file2.fmb, file3.fmb will be printed as file1, file2, file3.







      shell






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 19 mins ago









      Rui F Ribeiro

      37.3k1374118




      37.3k1374118










      asked Aug 13 '15 at 16:50









      Haroldo Payares Salgado

      32




      32




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          for f in *.fmb; do printf '%sn' "$f%.*"; done


          • Using pattern matching *.fmb to match all files end with .fmb


          • $f%.* is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f. Here we remove the extension part .fmb.





          share|improve this answer




















          • I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
            – Haroldo Payares Salgado
            Dec 19 '17 at 21:49










          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%2f223045%2fhow-to-list-only-the-file-names-of-the-same-type-in-the-directory%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










          for f in *.fmb; do printf '%sn' "$f%.*"; done


          • Using pattern matching *.fmb to match all files end with .fmb


          • $f%.* is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f. Here we remove the extension part .fmb.





          share|improve this answer




















          • I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
            – Haroldo Payares Salgado
            Dec 19 '17 at 21:49














          up vote
          2
          down vote



          accepted










          for f in *.fmb; do printf '%sn' "$f%.*"; done


          • Using pattern matching *.fmb to match all files end with .fmb


          • $f%.* is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f. Here we remove the extension part .fmb.





          share|improve this answer




















          • I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
            – Haroldo Payares Salgado
            Dec 19 '17 at 21:49












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          for f in *.fmb; do printf '%sn' "$f%.*"; done


          • Using pattern matching *.fmb to match all files end with .fmb


          • $f%.* is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f. Here we remove the extension part .fmb.





          share|improve this answer












          for f in *.fmb; do printf '%sn' "$f%.*"; done


          • Using pattern matching *.fmb to match all files end with .fmb


          • $f%.* is shell syntax for Parameter Expansion, remove the smallest suffix matched pattern in $f. Here we remove the extension part .fmb.






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 13 '15 at 17:11









          cuonglm

          99.5k23194292




          99.5k23194292











          • I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
            – Haroldo Payares Salgado
            Dec 19 '17 at 21:49
















          • I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
            – Haroldo Payares Salgado
            Dec 19 '17 at 21:49















          I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
          – Haroldo Payares Salgado
          Dec 19 '17 at 21:49




          I'm sorry for not thanked you earlier...I'm grateful for your answer, it helped me.
          – Haroldo Payares Salgado
          Dec 19 '17 at 21:49

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f223045%2fhow-to-list-only-the-file-names-of-the-same-type-in-the-directory%23new-answer', 'question_page');

          );

          Post as a guest













































































          kscMJY,9MF6XdTXudiRkaW95xr5pKqS2qHWU9NyB
          Z cx,6 nsM4fbUIh,2zwQBOZ XjteM,v,RkyEk kKJCpW5fcvn,cZjg2j Hy6E0,lZdUedmOnu7qdNfC8InOVUs5JIlxv,G6p

          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          How many registers does an x86_64 CPU actually have?

          Displaying single band from multi-band raster using QGIS