title: Terminal/bash: Join several .gz spplited files
body: <p>I'm not very familiar with the terminal but I'm trying to join several splitted .tar.gz files like </p>
  
  <ul>
  <li>file1.tar.gz_aa</li>
  <li>file1.tar.gz_ab</li>
  <li>file2.tar.gz_aa</li>
  <li>file2.tar.gz_ab</li>
  </ul>
  
  <p>within the same folder but I can only manage to get them all in the same file using: </p>
  
  <pre><code>for i in *.gz_; do cat ${i%/}* &gt; "${i%/}".joined; done
  </code></pre>
  
  <p>I've tried "nesting" loops like so:</p>
  
  <pre><code>for i in *.gz_;do for y in ${i}.gz_* do cat ${i}.gz_${y} &gt; ${i}.joined; done; done
  </code></pre>
  
  <p>but I get a syntax error near unexpected token `>'</p>
  
  <p><strong>Edit</strong>: I'm using Xubuntu for this (not sure if it matters) and my objective is to joind files in their original state (file1.tar.gz and file2.tar.gz). 
  I'm also trying to get just the filenames into an array using <code>${name%.tar.gz*}</code> but I'm so new to this I don't know yet how to remove duplicates and then "cat" them (sort -u hasn't worked)</p>