Answers.Body: <p>Try this one</p>
  
  <pre><code>for file in /dir/*
  do
    cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG "$file" &gt;&gt; results.out
  done
  </code></pre>
  
  <p>Also you have omitted <code>--discard-untrimmed</code> from the original command. If you want that as well along with everything to run in parallel:</p>
  
  <pre><code>for file in /dir/*
  do
    cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG --discard-untrimmed "<span class="math-container">$file" -o "`basename -s .fastq $</span>file`_out.fastq" &amp;
  done
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-10T21:33:46.890Z
Answers.LastActivityDate: 2020-03-12T14:20:38.600Z
Answers.LastEditDate: 2020-03-12T14:20:38.600Z
Answers.UserDisplayName: prab4th
Body: <p>I have DNA sample from 5 pools, having 25 fastq files each. I am running cutadapt to remove the primers using this command 
  <code>cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG A7_S7_R1_001.fastq -o sb_A7_S7_R1_001.fastq --discard-untrimmed</code>
  However, this is too time consuming.  I tried my hand at writing shell script</p>
  
  <pre><code>for file in /dir/*
  do
    cmd cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG "$file" &gt;&gt; results.out
  done
  </code></pre>
  
  <p>But it is not running . 
  Can someone help.
  Thanks</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-08T14:18:55.890Z
Comments.Text: I assume you don't really have `cmd` in there. Put and `ls` in just to see which files are seen.
Comments.UserDisplayName: Devon Ryan
Tags: <fastq><shell><cutadapt>
Title: processing multiple fastq files with cutadapt
ThreadText: # processing multiple fastq files with cutadapt
  
  (Asked by: username_0 on 2020-03-08)
  
  I have DNA sample from 5 pools, having 25 fastq files each. I am running cutadapt to remove the primers using this command
  `cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG A7_S7_R1_001.fastq -o sb_A7_S7_R1_001.fastq --discard-untrimmed`
  However, this is too time consuming. I tried my hand at writing shell script
  
  ```
  for file in /dir/*
  do
    cmd cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG "$file" >> results.out
  done
  
  ```
  
  But it is not running .
  Can someone help.
  Thanks
  
  **Tags:** fastq, shell, cutadapt
  
  > **Comments:**
  > **username_1**: I assume you don't really have `cmd` in there. Put and `ls` in just to see which files are seen.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-03-10. Score: 2
  
  Try this one
  
  ```
  for file in /dir/*
  do
    cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG "$file" >> results.out
  done
  
  ```
  
  Also you have omitted `--discard-untrimmed` from the original command. If you want that as well along with everything to run in parallel:
  
  ```
  for file in /dir/*
  do
    cutadapt -g ACTTAAGTGTATGTAAACTTCCGACTTCAACTG --discard-untrimmed "$file" -o "`basename -s .fastq $file`_out.fastq" &
  done
  
  ```
  
  
  ---
  
  