I have two CSV files with the same headers, called a.csv and b.csv. How can I merge the two files into a third c.csv, such that c is composed of all the rows from a and b?
Here is my answer (ignore first row & add nextline)
cat sample1.csv <(echo) <(tail +2 sample2.csv) > sample3.csv
A basic merge would be
cat a.csv <(tail +2 b.csv) > c.csv
This will put all of b.csv
after a.csv
.
Edit
I've added the <(tail +2 b.csv)
. It will skip the header in the b.csv
file.
edit2
$ cat a.csv
hdr
a
b
c
$ cat b.csv
hdr
e
f
g
$ cat a.csv <(tail +2 b.csv)
hdr
a
b
c
e
f
g
IHTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With