title: Using grep to search DNA sequence files
body: <p>I am trying to using Unix's grep to search for specific sequences within files. The files are usually very large (~1Gb) of 'A's, 'T's, 'C's, and 'G's.  These files also span many, many lines with each line being a word of 60ish characters. The problem I am having is that when I search for a specific sequence within these files grep will return results for the pattern that occur on a single line, but not if the pattern spans a line (has a line break somewhere in the middle). For example:</p>
  
  <p>Using</p>
  
  <pre><code>$ grep -i -n "GACGGCT" grep3.txt 
  </code></pre>
  
  <p>To search the file grep3.txt (I put the target 'GACGGCT's in double stars)</p>
  
  <pre><code>GGGCTTCGA**GACGGCT**GACGGCTGCCGTGGAGTCT
  CCAGACCTGGCCCTCCCTGGCAGGAGGAGCCTG**GA
  CGGCT**AGGTGAGAGCCAGCTCCAAGGCCTCTGGGC
  CACCAGGCCAGCTCAGGCCACCCCTTCCCCAGTCA
  CCCCCCAAGAGGTGCCCCAGACAGAGCAGGGGCCA
  GGCGCCCTGAGGC**GACGGCT**CTCAGCCTCCGCCCC
  </code></pre>
  
  <p>Returns </p>
  
  <pre><code>3:GGGCTTCGAGACGGCTGACGGCTGCCGTGGAGTCT
  8:GGCGCCCTGAGGCGACGGCTCTCAGCCTCCGCCCC
  </code></pre>
  
  <p>So, my problem here is that <code>grep</code> does not find the <code>GACGGCT</code> that spans the end of line 2 and the beginning of line 3. </p>
  
  <p>How can I use grep to find target sequences that may or may not include a linebreak at any point in the string?  Or how can I tell <code>grep</code> to ignore linebreaks in the target string? Is there a simple way to do this?</p>