How can I merge two CSV files from command line?

NumenorForLife

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?

shellter

A basic merge would be

 cat a.csv <(tail +2 b.csv) > c.csv

This will put all of b.csvafter 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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How I can retrieve emails and websites from csv files in command line?

From Dev

merge two csv files, command wont print first line

From Dev

how can I print multiple odt files from the command line?

From Dev

How can I compare the versions of two executables from the command line?

From Dev

How can I merge files on a line by line basis?

From Dev

How to merge two files' data line by line?

From Dev

How can I read from two different CSV files and create two different arrays without duplicating code?

From Dev

How can I compare two files line by line?

From Dev

Can I mark files as recently-used from the command line?

From Dev

How can I merge two JSON files and then retrieve it?

From Dev

How can I merge some columns of two files using perl?

From Dev

How can I merge two files in Pentaho Data Integration (Kettle)

From Dev

How can I merge two branches without losing any files?

From Dev

How can I merge two files in Pentaho Data Integration (Kettle)

From Dev

How can I merge the lines of two files by having common headers?

From Dev

how can I merge two txt files by one similar string

From Dev

how can I merge two text files together

From Dev

How to open two files from command line, with both at the end of the file?

From Dev

How can I `find` files matching pattern within a directory matching another pattern from the command line?

From Dev

How can I retrieve files which are deleted from command line using rm -rf in unix?

From Dev

How can I print svg files from command line using image viewer (eog) or lpr?

From Dev

Merge every second line from two files

From Dev

How can I write to the second line of a file from the command line?

From Dev

How can I get a count of files in a directory using the command line?

From Dev

How can I input two values in a single command line?

From Dev

How to merge two csv files not including duplicates

From Dev

How to merge two .csv files in javascript?

From Dev

How do I compile and link multiple files from the command line?

From Dev

How do I FTP multiple files from the command line?

Related Related

  1. 1

    How I can retrieve emails and websites from csv files in command line?

  2. 2

    merge two csv files, command wont print first line

  3. 3

    how can I print multiple odt files from the command line?

  4. 4

    How can I compare the versions of two executables from the command line?

  5. 5

    How can I merge files on a line by line basis?

  6. 6

    How to merge two files' data line by line?

  7. 7

    How can I read from two different CSV files and create two different arrays without duplicating code?

  8. 8

    How can I compare two files line by line?

  9. 9

    Can I mark files as recently-used from the command line?

  10. 10

    How can I merge two JSON files and then retrieve it?

  11. 11

    How can I merge some columns of two files using perl?

  12. 12

    How can I merge two files in Pentaho Data Integration (Kettle)

  13. 13

    How can I merge two branches without losing any files?

  14. 14

    How can I merge two files in Pentaho Data Integration (Kettle)

  15. 15

    How can I merge the lines of two files by having common headers?

  16. 16

    how can I merge two txt files by one similar string

  17. 17

    how can I merge two text files together

  18. 18

    How to open two files from command line, with both at the end of the file?

  19. 19

    How can I `find` files matching pattern within a directory matching another pattern from the command line?

  20. 20

    How can I retrieve files which are deleted from command line using rm -rf in unix?

  21. 21

    How can I print svg files from command line using image viewer (eog) or lpr?

  22. 22

    Merge every second line from two files

  23. 23

    How can I write to the second line of a file from the command line?

  24. 24

    How can I get a count of files in a directory using the command line?

  25. 25

    How can I input two values in a single command line?

  26. 26

    How to merge two csv files not including duplicates

  27. 27

    How to merge two .csv files in javascript?

  28. 28

    How do I compile and link multiple files from the command line?

  29. 29

    How do I FTP multiple files from the command line?

HotTag

Archive