I have two sets of folders that have files with the same file names and structure . The folder structure looks something like this:
\outputfolder\
|
| |
| |
|
|
|
|
So what I need to do is to merge (add) all files with the same name in these folders (file1.txt with file1.txt, etc.) into another file inside the output folder. After receiving these combined files, I also need to create a tar.gz file from all of these combined files.
How can I do this in a Linux based command line environment? The folder name (folder1 and folder2, etc.) is a variable, so this needs to be provided, but the files are not needed, and it should automatically combine all the files with the same name.
In addition, these files have headers for column names, so I will need to remove this also when adding.
source
share