title: Combining two files in different folders in Linux
body: <p>I have two set of folders that have files with the <strong>same filenames and structure</strong>. The folder structure is something like this:</p>
  
  <pre><code>\outputfolder\
   |---\folder1\
   |      |---file1.txt
   |      |---file2.txt
   |
   |---\folder2\
          |---file1.txt
          |---file2.txt
  </code></pre>
  
  <p>So what I need to do is to combine (append) all the files with the same name in these folders (file1.txt with file1.txt etc.) into another file inside the outputfolder. After getting these combined files I also need to create a tar.gz file from all of these combined files.</p>
  
  <p>How can I accomplish this in a Linux based command line environment? The folder name (folder1 and folder2 etc) is variable so this needs to be given but the files need not and it should automatically combine all the files with the same name. </p>
  
  <p>Also, these files have headers for column names, so I would need to remove that as well while appending.</p>