text: user10807: Okay so I'm using grep to try and get a preview of some trimming operations that are not going as expected..
  Lets say that my sequence in the FastQ file is: ATNGCNATCG
  What I want to do is..
  grep "ATCGCTATCG" my.fastq
  ..and match the sequence given above
  Surely there is some way or some existing tool that I can use besides doing:
  grep "[A|N][T|N][C|N][G|N][C|N]...etc."
  
  user6251: If you want to stick to grep, use a scripting language such as Perl to generate the regex programmatically. For example:
  perl -le 'print join "", map "[${_}N]", split //, $ARGV[0];' ATCGCTATCG 
  
  Prints:
  [AN][TN][CN][GN][CN][TN][AN][TN][CN][GN]
  
  You can use it in grep like so:
  grep '[AN][TN][CN][GN][CN][TN][AN][TN][CN][GN]' <<< ATNGCNATCG
  
  Prints:
  ATNGCNATCG
  
  If that works for you, you could make it into a little bash function that also runs the grep. Add these lines to your ~/.bashrc:
  grepN(){
      seq="$1"
      file="$2"
      pattern=$(perl -le 'print join "", map "[${_}N]", split //, $ARGV[0];' "$seq")
      grep "$pattern" "$file"
  }
  
  You can now run
  grepN ATCGCTATCG my.fastq
  
  Of course, this is not a good idea since the sequence might be in different lines, but that's what you were doing originally.
  
original_text: 10807: <p>Okay so I'm using grep to try and get a preview of some trimming operations that are not going as expected..
  Lets say that my sequence in the FastQ file is: ATNGCNATCG</p>
  <p>What I want to do is..</p>
  <p><code>grep &quot;ATCGCTATCG&quot; my.fastq</code></p>
  <p>..and match the sequence given above</p>
  <p>Surely there is some way or some existing tool that I can use besides doing:
  <code>grep &quot;[A|N][T|N][C|N][G|N][C|N]...etc.&quot;</code></p>
   6251: <p>If you want to stick to <code>grep</code>, use a scripting language such as Perl to generate the regex programmatically. For example:</p>
  <pre><code>perl -le 'print join &quot;&quot;, map &quot;[${_}N]&quot;, split //, $ARGV[0];' ATCGCTATCG 
  </code></pre>
  <p>Prints:</p>
  <pre><code>[AN][TN][CN][GN][CN][TN][AN][TN][CN][GN]
  </code></pre>
  <p>You can use it in <code>grep</code> like so:</p>
  <pre><code>grep '[AN][TN][CN][GN][CN][TN][AN][TN][CN][GN]' &lt;&lt;&lt; ATNGCNATCG
  </code></pre>
  <p>Prints:</p>
  <pre><code>ATNGCNATCG
  </code></pre>
  <p>If that works for you, you could make it into a little bash function that also runs the <code>grep</code>. Add these lines to your <code>~/.bashrc</code>:</p>
  <pre class="lang-bash prettyprint-override"><code>grepN(){
      seq=&quot;$1&quot;
      file=&quot;$2&quot;
      pattern=$(perl -le 'print join &quot;&quot;, map &quot;[${_}N]&quot;, split //, $ARGV[0];' &quot;$seq&quot;)
      grep &quot;$pattern&quot; &quot;$file&quot;
  }
  </code></pre>
  <p>You can now run</p>
  <pre><code>grepN ATCGCTATCG my.fastq
  </code></pre>
  <p>Of course, this is not a good idea since the sequence might be in different lines, but that's what you were doing originally.</p>
  