title: bash: zcat vs. cat discrepancy for concatenating .gz files
body: <p>Here I've got a problem with my shell script. In my data analysis pipeline, I need to concatenate multiple gzipped files priore downstream analysis. These gzipped files come in pairs, so I need to concatenate all pair1 together and all pair2 together. My script for this looks like this:</p>
  
  <pre><code>for f in "${pair1_fqs[@]}"; do
      zcat "${f//\"/}" &gt;&gt; "$sampleID"_cat1.fq
  done
  
  for f in "${pair2_fqs[@]}"; do
      zcat "${f//\"/}" &gt;&gt; "$sampleID"_cat2.fq
  done
  </code></pre>
  
  <p>the problem is zcat and cat returns different results:</p>
  
  <pre><code>zcat myfile.gz | wc -l
  75896232
  cat myfile.gz| wc -l
  82322094
  </code></pre>
  
  <p>I was wondering if anyone here knows what could be the reason for this discrepancy!</p>