Answers.Body: <p>Haven't tried, but I believe you may add <code>-Z</code> to fasterq-dump and remove <code>-k ${i}</code> from gzip. In addition, I would recommend the following:</p>
  <pre class="lang-sh prettyprint-override"><code>cat SRR_Acc_List.txt | xargs -i echo fasterq-dump {} --split-spot -Z -v --skip-technical -e 15 \| gzip &gt; {}.gz | sh
  </code></pre>
  <p>It is simpler and more flexible. For example, replacing <code>sh</code> with <code>parallel</code> would allow you to download in parallel.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-08T13:26:53.297Z
Answers.LastActivityDate: 2023-06-08T13:26:53.297Z
Answers.UserDisplayName: user172818
Answers.Body: <p>I tried this and it worked</p>
  <pre><code>cat SRR_Acc_List.txt | while read i ; do  fasterq-dump ${i} --split-spot -v --skip-technical  -e 20 ; for j in i ; do   gzip ${i}.fastq  ; done; done
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-12T09:11:52.670Z
Answers.LastActivityDate: 2023-06-12T19:33:32.853Z
Answers.LastEditDate: 2023-06-12T19:33:32.853Z
Answers.UserDisplayName: Shradha Sharma
Body: <p>I want to zip the files generated by fasterq-dump simultaneously as they are generated. The code that I tried is this.</p>
  <pre><code>cat SRR_Acc_List.txt | while read i 
  do  fasterq-dump ${i} --split-spot -v --skip-technical  -e 15| gzip -k  ${i}&gt; ${i}.gz 
  done
  </code></pre>
  
Tags: <ncbi><sra>
Title: ZIP the fasterq-dump files in loop
ThreadText: # ZIP the fasterq-dump files in loop
  
  (Asked by: username_0 on 2023-06-08)
  
  I want to zip the files generated by fasterq-dump simultaneously as they are generated. The code that I tried is this.
  
  ```
  cat SRR_Acc_List.txt | while read i 
  do  fasterq-dump ${i} --split-spot -v --skip-technical  -e 15| gzip -k  ${i}> ${i}.gz 
  done
  
  ```
  
  **Tags:** ncbi, sra
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2023-06-08. Score: 1
  
  Haven't tried, but I believe you may add `-Z` to fasterq-dump and remove `-k ${i}` from gzip. In addition, I would recommend the following:
  
  ```sh
  cat SRR_Acc_List.txt | xargs -i echo fasterq-dump {} --split-spot -Z -v --skip-technical -e 15 \| gzip > {}.gz | sh
  
  ```
  
  It is simpler and more flexible. For example, replacing `sh` with `parallel` would allow you to download in parallel.
  
  
  ---
  
  ### Answer by username_0 on 2023-06-12. Score: 1
  
  I tried this and it worked
  
  ```
  cat SRR_Acc_List.txt | while read i ; do  fasterq-dump ${i} --split-spot -v --skip-technical  -e 20 ; for j in i ; do   gzip ${i}.fastq  ; done; done
  
  ```
  
  
  ---
  
  