title: Concatenating every other file from a list of files
body: <p>I have a list of files:</p>
  <p>MD5.txt</p>
  <pre><code>8530362a272d04efef64b7f1ae0d1069  NGS35_FKDN210261811-1A_H3YNKDSX2_L4_1.fq.gz
  9b34bdbbb17cdb1205035e24124fed1a  NGS35_FKDN210261811-1A_H3YNKDSX2_L4_2.fq.gz
  00f8f992334458383fc1a5c7b06d403e  NGS35_FKDN210261811-1A_H5JY3DSX2_L4_1.fq.gz
  cca0e17b3dcc1e644ec1a9a4a60a851e  NGS35_FKDN210261811-1A_H5JY3DSX2_L4_2.fq.gz
  </code></pre>
  <p>I want to concatenate the 1st and 3rd files and the 2nd and 4th like this:</p>
  <pre><code>cat NGS35_FKDN210261811-1A_H3YNKDSX2_L4_1.fq.gz NGS35_FKDN210261811-1A_H5JY3DSX2_L4_1.fq.gz &gt;NGS35_L4_1.fq.gz
  
  cat NGS35_FKDN210261811-1A_H3YNKDSX2_L4_2.fq.gz NGS35_FKDN210261811-1A_H5JY3DSX2_L4_2.fq.gz &gt;NGS35_L4_2.fq.gz
  </code></pre>
  <p>I've got so far but I can't concatenate the actual files together, rather I'm just concatenating the files names...</p>
  <pre><code>#get files names
  awk -v OFS=&quot;\t&quot; '$1=$1' MD5.txt | cut -f2 &gt; tmp
  
  #get sample ID
  ID=$(sed 's/_.*//' tmp | head -1)
  
  #get lines needed
  sed '1q;d' tmp &gt; file1
  sed '3q;d' tmp &gt; file2
  
  sed '2q;d' tmp &gt; file3
  sed '4q;d' tmp &gt; file4
  
  #Cat files together - this doesn't work!!
  cat file1 file2 &gt; ${ID}_L4_1.fq.gz
  cat file1 file2 &gt; ${ID}_L4_2.fq.gz
  
  rm file* tmp
  </code></pre>
  <p>I'm sure there is probably a one liner... go easy, I'm a clinician not a bioinformatician!</p>