text: user4401: Or Kbps/Gbps. It feels like it should be conceptually very simple, but I can't seem to figure out the right combination of keywords to find it via my search engine. Help would be appreciated!
  I have BBMAP, SRAtoolkit and MEGAHIT already installed, and also use bash. I'd be very happy if this can be answered with software that I already have, but if not that's perfectly fine.
  
  user8919: The number of bases in a fastq file can be counted in bash with awk and wc
  awk 'NR % 4 == 0' ORS="" fastqfile|wc -m
  
  The awk code prints every fourth line (which is actually the quality scores, but that doesn't matter here). wc -m returns the total number of characters.
  Edited to add ORS="" to prevent count of newlines (the double quotes are not strictly required)
  
  user6251: Using Perl:
  Print the sequence lines (line number 2, 6, 10, etc). Remove the newlines with chomp. Count the bytes (here, bases) using wc -c:
  perl -ne 'if ( $. % 4 == 2 ) { chomp; print; }' | wc -c
  
  
  user294: I've been using this:
  cat file.fastq | paste - - - - | cut -f 2 | tr -d '\n' | wc -c 
  Explanation :
  
  paste - - - - : print four consecutive lines in one row (tab delimited), to merge the info for each read
  
  cut -f2 : print only the second column, to access the sequence after the paste
  
  wc -c : count the characters
  
  tr -d '\n': to remove from count the eventual newline characters
  
  
  (a tip for your googling: try search for "counting number of bases in fastq file")
  
original_text: 4401: <p>Or Kbps/Gbps. It feels like it should be conceptually very simple, but I can't seem to figure out the right combination of keywords to find it via my search engine. Help would be appreciated!</p>
  <p>I have BBMAP, SRAtoolkit and MEGAHIT already installed, and also use bash. I'd be very happy if this can be answered with software that I already have, but if not that's perfectly fine.</p>
   8919: <p>The number of bases in a fastq file can be counted in bash with awk and wc</p>
  <pre><code>awk 'NR % 4 == 0' ORS=&quot;&quot; fastqfile|wc -m
  </code></pre>
  <p>The awk code prints every fourth line (which is actually the quality scores, but that doesn't matter here). wc -m returns the total number of characters.</p>
  <p>Edited to add ORS=&quot;&quot; to prevent count of newlines (the double quotes are not strictly required)</p>
   6251: <p><strong>Using Perl:</strong><br />
  Print the sequence lines (line number 2, 6, 10, etc). Remove the newlines with <code>chomp</code>. Count the bytes (here, bases) using <code>wc -c</code>:</p>
  <pre><code>perl -ne 'if ( $. % 4 == 2 ) { chomp; print; }' | wc -c
  </code></pre>
   294: <p>I've been using this:</p>
  <p><code>cat file.fastq | paste - - - - | cut -f 2 | tr -d '\n' | wc -c </code></p>
  <p>Explanation :</p>
  <ul>
  <li><p><code>paste - - - -</code> : print four consecutive lines in one row (tab delimited), to merge the info for each read</p>
  </li>
  <li><p><code>cut -f2</code> : print only the second column, to access the sequence after the paste</p>
  </li>
  <li><p><code>wc -c</code> : count the characters</p>
  </li>
  <li><p><code>tr -d '\n'</code>: to remove from count the eventual newline characters</p>
  </li>
  </ul>
  <p>(a tip for your googling: try search for &quot;counting number of bases in fastq file&quot;)</p>
  