(Terminal) How to loop through files while still multithreading?How do I find the width & height of a terminal window?How to exit a git status list in terminal?How to remove files and directories quickly via terminal (bash shell)How do servlets work? Instantiation, sessions, shared variables and multithreadingHow do you run JavaScript script through the Terminal?How do I clear/delete the current line in terminal?Mac ssh terminalHow to get the current date and time in the terminal and set a custom command in terminal for it?Mac Terminal Bash awk change multiple file names to $NF outputWrite to file, but interpret/remove (get rid of) terminal escape sequences

Can I make popcorn with any corn?

What's the point of deactivating Num Lock on login screens?

What are the differences between the usage of 'it' and 'they'?

Did Shadowfax go to Valinor?

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Show that if two triangles built on parallel lines, with equal bases have the same perimeter only if they are congruent.

How old can references or sources in a thesis be?

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

How to write a macro that is braces sensitive?

Why don't electron-positron collisions release infinite energy?

Is it possible to do 50 km distance without any previous training?

Why do I get two different answers for this counting problem?

Python: next in for loop

What would happen to a modern skyscraper if it rains micro blackholes?

What is the word for reserving something for yourself before others do?

Mage Armor with Defense fighting style (for Adventurers League bladeslinger)

I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine

Why Is Death Allowed In the Matrix?

Arthur Somervell: 1000 Exercises - Meaning of this notation

Watching something be written to a file live with tail

Dragon forelimb placement

Why was the small council so happy for Tyrion to become the Master of Coin?

Font hinting is lost in Chrome-like browsers (for some languages )

"to be prejudice towards/against someone" vs "to be prejudiced against/towards someone"



(Terminal) How to loop through files while still multithreading?


How do I find the width & height of a terminal window?How to exit a git status list in terminal?How to remove files and directories quickly via terminal (bash shell)How do servlets work? Instantiation, sessions, shared variables and multithreadingHow do you run JavaScript script through the Terminal?How do I clear/delete the current line in terminal?Mac ssh terminalHow to get the current date and time in the terminal and set a custom command in terminal for it?Mac Terminal Bash awk change multiple file names to $NF outputWrite to file, but interpret/remove (get rid of) terminal escape sequences






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am running a (bioinformatics) package called fastqc. The command I'm running allows users to specify the number of threads to use. For example:



patrick$ fastqc 039210Sm_S1_L001_R1_001.fastq.gz 039210Sm_S1_L001_R2_001.fastq.gz --extract --outdir=/the/output/folder --threads=2


will execute the command on both files at once, as desired. In practice, I cannot copy-paste the names of each file (since there aren't just two, but rather 100s). So instead what I am trying to do is change my directory to the folder where these documents are stored and run code that will loop through each file. This is what I came up with:



patrick$ cd folder/containing/my/files
patrick$ for i in *.fastq.gz;
>do fastqc $i --extract --outdir=/the/output/folder --threads=4;
>done


However, this code does not run on four files at once. Rather, it only uses one thread. Is there any way to loop through every file in a folder while still multithreading?
One thing I thought about was exporting all the file names to a text document via ls > names.txt, but I wasn't sure how to proceed from there, nor was I able to find anyone on the forums with an analogous problem.



Thank you for taking the time to read this, regardless of whether or not you knew the answer.



OS information: I am using Terminal version 2.9.1 (421.1) on a MacBook Pro (Retina, 15-inch, Mid 2015).



Temporary workaround: I ran ls > names.txt, opened that file in Word, found all enters ^p and replaced it with a space, . Copied and pasted that entire document into Terminal. That one command took up 25 lines and the whole process takes a while, but other than that it's working alright. Still looking for a solution, though.










share|improve this question






























    0















    I am running a (bioinformatics) package called fastqc. The command I'm running allows users to specify the number of threads to use. For example:



    patrick$ fastqc 039210Sm_S1_L001_R1_001.fastq.gz 039210Sm_S1_L001_R2_001.fastq.gz --extract --outdir=/the/output/folder --threads=2


    will execute the command on both files at once, as desired. In practice, I cannot copy-paste the names of each file (since there aren't just two, but rather 100s). So instead what I am trying to do is change my directory to the folder where these documents are stored and run code that will loop through each file. This is what I came up with:



    patrick$ cd folder/containing/my/files
    patrick$ for i in *.fastq.gz;
    >do fastqc $i --extract --outdir=/the/output/folder --threads=4;
    >done


    However, this code does not run on four files at once. Rather, it only uses one thread. Is there any way to loop through every file in a folder while still multithreading?
    One thing I thought about was exporting all the file names to a text document via ls > names.txt, but I wasn't sure how to proceed from there, nor was I able to find anyone on the forums with an analogous problem.



    Thank you for taking the time to read this, regardless of whether or not you knew the answer.



    OS information: I am using Terminal version 2.9.1 (421.1) on a MacBook Pro (Retina, 15-inch, Mid 2015).



    Temporary workaround: I ran ls > names.txt, opened that file in Word, found all enters ^p and replaced it with a space, . Copied and pasted that entire document into Terminal. That one command took up 25 lines and the whole process takes a while, but other than that it's working alright. Still looking for a solution, though.










    share|improve this question


























      0












      0








      0








      I am running a (bioinformatics) package called fastqc. The command I'm running allows users to specify the number of threads to use. For example:



      patrick$ fastqc 039210Sm_S1_L001_R1_001.fastq.gz 039210Sm_S1_L001_R2_001.fastq.gz --extract --outdir=/the/output/folder --threads=2


      will execute the command on both files at once, as desired. In practice, I cannot copy-paste the names of each file (since there aren't just two, but rather 100s). So instead what I am trying to do is change my directory to the folder where these documents are stored and run code that will loop through each file. This is what I came up with:



      patrick$ cd folder/containing/my/files
      patrick$ for i in *.fastq.gz;
      >do fastqc $i --extract --outdir=/the/output/folder --threads=4;
      >done


      However, this code does not run on four files at once. Rather, it only uses one thread. Is there any way to loop through every file in a folder while still multithreading?
      One thing I thought about was exporting all the file names to a text document via ls > names.txt, but I wasn't sure how to proceed from there, nor was I able to find anyone on the forums with an analogous problem.



      Thank you for taking the time to read this, regardless of whether or not you knew the answer.



      OS information: I am using Terminal version 2.9.1 (421.1) on a MacBook Pro (Retina, 15-inch, Mid 2015).



      Temporary workaround: I ran ls > names.txt, opened that file in Word, found all enters ^p and replaced it with a space, . Copied and pasted that entire document into Terminal. That one command took up 25 lines and the whole process takes a while, but other than that it's working alright. Still looking for a solution, though.










      share|improve this question
















      I am running a (bioinformatics) package called fastqc. The command I'm running allows users to specify the number of threads to use. For example:



      patrick$ fastqc 039210Sm_S1_L001_R1_001.fastq.gz 039210Sm_S1_L001_R2_001.fastq.gz --extract --outdir=/the/output/folder --threads=2


      will execute the command on both files at once, as desired. In practice, I cannot copy-paste the names of each file (since there aren't just two, but rather 100s). So instead what I am trying to do is change my directory to the folder where these documents are stored and run code that will loop through each file. This is what I came up with:



      patrick$ cd folder/containing/my/files
      patrick$ for i in *.fastq.gz;
      >do fastqc $i --extract --outdir=/the/output/folder --threads=4;
      >done


      However, this code does not run on four files at once. Rather, it only uses one thread. Is there any way to loop through every file in a folder while still multithreading?
      One thing I thought about was exporting all the file names to a text document via ls > names.txt, but I wasn't sure how to proceed from there, nor was I able to find anyone on the forums with an analogous problem.



      Thank you for taking the time to read this, regardless of whether or not you knew the answer.



      OS information: I am using Terminal version 2.9.1 (421.1) on a MacBook Pro (Retina, 15-inch, Mid 2015).



      Temporary workaround: I ran ls > names.txt, opened that file in Word, found all enters ^p and replaced it with a space, . Copied and pasted that entire document into Terminal. That one command took up 25 lines and the whole process takes a while, but other than that it's working alright. Still looking for a solution, though.







      multithreading terminal






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 3:57







      Patrick

















      asked Mar 7 at 6:06









      PatrickPatrick

      63




      63






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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: 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
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55037074%2fterminal-how-to-loop-through-files-while-still-multithreading%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f55037074%2fterminal-how-to-loop-through-files-while-still-multithreading%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

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко