I need to merge multiple .CSV files (using the
cat command) but without copying the header for each file.
What's the best way to accomplish this task?
You'll need more than the
Say you have 3 CSV-files:
either (keep header from first file):
or (remove header from all files who's names begin with "file"):
You could also use a group command (
It also works with CRLF line endings as long as the files end with an empty line (
The number-only versions of head and tail were made obsolete by POSIX 1003.1-2001, and they result in warnings in some environments.
Using the command sequence above resulted in a file looking like this:
To make it a proper CSV, with one header line and all the relevant values, I employed the following