If you have a collection of tab or comma delimited files that you want to combine or merge into one document, you can use the CMD TYPE command:
type *.txt > mergedfile.txt
type *.txt > mergedfile.txt
The TYPE command displays the contents of one or more text files to the console.
This will work as long as each file follows the same formatting. For example, you can use it to combine files that are either all tab delimited or comma delimited, but you shouldn’t use it to combine a .tsv with a .csv.
The TYPE command accepts one or more files as a parameter. In this case I used the wildcard character (*) to pass all files in the current directory ending in .txt as arguments to the TYPE command.
The ‘>’ symbol redirects the output to a destination of our choice. Without this symbol TYPE would output the merged file straight to the console. In most cases we want to save the merged file to use for some other purpose, so we redirect the output to a file of our choosing. You can name mergedfile.txt anything you want.
Example:
Suppose we have two tab delimited files: file1.tsv and file2.tsv
file1.tsv
First Name Last Name Age
file2.tsv
John Doe 30
Jane Smith 53
Make sure you are in the directory that contains file1 and file2 and enter the command:
type file1.tsv file2.tsv > mergedfiles.tsv
And the result is:
mergedfiles.tsv
First Name Last Name Age
John Doe 30
Jane Smith 53