9951 explained code solutions for 126 technologies


csvkitHow to join two files with csvkit?


csvkit is a suite of command-line tools for working with CSV, the most popular being csvjoin. It can be used to join two CSV files on a common field.

Example code

csvjoin -c common_field file1.csv file2.csv

Output example

common_field,field1,field2,field3
value1,value4,value5,value6
value2,value7,value8,value9

Code explanation

  • csvjoin: the command to join two CSV files
  • -c: the flag to specify the common field
  • common_field: the name of the common field
  • file1.csv: the first CSV file
  • file2.csv: the second CSV file

Helpful links

Edit this code on GitHub