Great unix one liner to join two tables keys in the first columns

Suppose file column_ids.csv contains the first column with some IDs. You have a table big_table.csv with the first column also containing IDs. We can join the two files in unix shell:

join -t "," <(sort file_1.csv)  <(sort file_2.csv) > result.csv

-t option specifies a delimiter.
Both files must be sorted in the same order on the key value.

Advertisements
This entry was posted in Bash, Productivity, Programming, UNIX/Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s