Skip to content

Instantly share code, notes, and snippets.

@isseium
Created February 10, 2015 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isseium/3501faf5a5f25e9c5a28 to your computer and use it in GitHub Desktop.
Save isseium/3501faf5a5f25e9c5a28 to your computer and use it in GitHub Desktop.
2つのテキストファイルを join コマンドで結合する ref: http://qiita.com/isseium/items/20eb6802898d9b1ba2b4
100,a
200,b
400,c
200,x
300,y
500,z
$ join -t, a.txt b.txt
200,b,x
(明示的にした場合)
$ join -t, -1 1 -2 1 -o 0 1.2 2.2 a.txt b.txt
200,b,x
$ join -t, -a 1 -1 1 -2 1 -o 0 1.2 2.2 -e 'NULL' a.txt b.txt
100,a,NULL
200,b,x
400,c,NULL
$ join -t, -a 1 -a 2 -1 1 -2 1 -o 0 1.2 2.2 -e "NULL" a.txt b.txt
100,a,NULL
200,b,x
300,NULL,y
400,c,NULL
500,NULL,z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment