(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

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved