script of reading one type of files in multiple directory











up vote
0
down vote

favorite












I have the Directory like 2018-01-10, 2018-02,10 and so on. In each directory it contains .CUD and .CUR files. I want the number of data (i.e. wc -l) which are in .CUD files only.



I used following command:



for D in /; do
wc -l ${D}/ > ${D%/}Request
done


It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD files only.










share|improve this question









New contributor




user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    I have the Directory like 2018-01-10, 2018-02,10 and so on. In each directory it contains .CUD and .CUR files. I want the number of data (i.e. wc -l) which are in .CUD files only.



    I used following command:



    for D in /; do
    wc -l ${D}/ > ${D%/}Request
    done


    It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD files only.










    share|improve this question









    New contributor




    user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have the Directory like 2018-01-10, 2018-02,10 and so on. In each directory it contains .CUD and .CUR files. I want the number of data (i.e. wc -l) which are in .CUD files only.



      I used following command:



      for D in /; do
      wc -l ${D}/ > ${D%/}Request
      done


      It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD files only.










      share|improve this question









      New contributor




      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have the Directory like 2018-01-10, 2018-02,10 and so on. In each directory it contains .CUD and .CUR files. I want the number of data (i.e. wc -l) which are in .CUD files only.



      I used following command:



      for D in /; do
      wc -l ${D}/ > ${D%/}Request
      done


      It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD files only.







      bash scripts wc






      share|improve this question









      New contributor




      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 2 days ago









      Mr Shunz

      2,2011722




      2,2011722






      New contributor




      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      user893815

      11




      11




      New contributor




      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user893815 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Read man find,man xargs and use something like



          find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l





          share|improve this answer





















          • THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
            – user893815
            2 days ago






          • 3




            @user893815 - What happened when you execute the above command?
            – Yaron
            2 days ago








          • 1




            If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
            – waltinator
            2 days ago










          • waltinator if you don't understand the situation . DON'T COMMENT
            – user893815
            2 days ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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
          });


          }
          });






          user893815 is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1094143%2fscript-of-reading-one-type-of-files-in-multiple-directory%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Read man find,man xargs and use something like



          find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l





          share|improve this answer





















          • THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
            – user893815
            2 days ago






          • 3




            @user893815 - What happened when you execute the above command?
            – Yaron
            2 days ago








          • 1




            If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
            – waltinator
            2 days ago










          • waltinator if you don't understand the situation . DON'T COMMENT
            – user893815
            2 days ago















          up vote
          0
          down vote













          Read man find,man xargs and use something like



          find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l





          share|improve this answer





















          • THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
            – user893815
            2 days ago






          • 3




            @user893815 - What happened when you execute the above command?
            – Yaron
            2 days ago








          • 1




            If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
            – waltinator
            2 days ago










          • waltinator if you don't understand the situation . DON'T COMMENT
            – user893815
            2 days ago













          up vote
          0
          down vote










          up vote
          0
          down vote









          Read man find,man xargs and use something like



          find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l





          share|improve this answer












          Read man find,man xargs and use something like



          find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 days ago









          waltinator

          21.6k74169




          21.6k74169












          • THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
            – user893815
            2 days ago






          • 3




            @user893815 - What happened when you execute the above command?
            – Yaron
            2 days ago








          • 1




            If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
            – waltinator
            2 days ago










          • waltinator if you don't understand the situation . DON'T COMMENT
            – user893815
            2 days ago


















          • THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
            – user893815
            2 days ago






          • 3




            @user893815 - What happened when you execute the above command?
            – Yaron
            2 days ago








          • 1




            If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
            – waltinator
            2 days ago










          • waltinator if you don't understand the situation . DON'T COMMENT
            – user893815
            2 days ago
















          THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
          – user893815
          2 days ago




          THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
          – user893815
          2 days ago




          3




          3




          @user893815 - What happened when you execute the above command?
          – Yaron
          2 days ago






          @user893815 - What happened when you execute the above command?
          – Yaron
          2 days ago






          1




          1




          If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
          – waltinator
          2 days ago




          If you read man find you'll see that you can replace the . (the current directory) with a list of directories for find to start searching. Also, DON'T SHOUT.
          – waltinator
          2 days ago












          waltinator if you don't understand the situation . DON'T COMMENT
          – user893815
          2 days ago




          waltinator if you don't understand the situation . DON'T COMMENT
          – user893815
          2 days ago










          user893815 is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          user893815 is a new contributor. Be nice, and check out our Code of Conduct.













          user893815 is a new contributor. Be nice, and check out our Code of Conduct.












          user893815 is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1094143%2fscript-of-reading-one-type-of-files-in-multiple-directory%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

          數位音樂下載

          格利澤436b

          When can things happen in Etherscan, such as the picture below?