Below are screenshots of a few CSV files to merge.
- Using a text editor, create a script or batch file. In the editor, type in the tail command to create a new merged file with a header.
tail -n +1 -q green.csv > merge.csv
Note: -n +1 means to start from the first line.
A single > means to output to a new file
- Type in the commands to append lines from subsequent files without headers to the output file.
tail -n +2 -q orange.csv >> merge.csv
tail -n +2 -q transfer.csv >> merge.csv#...etc...
Note: -n +2 means to start from the 2nd line
>> means to append to the output file
- Run the script or batch file in a Command Prompt.
The CSV files are merged.
No comments:
Post a Comment