Created
February 10, 2015 15:31
-
-
Save isseium/3501faf5a5f25e9c5a28 to your computer and use it in GitHub Desktop.
2つのテキストファイルを join コマンドで結合する ref: http://qiita.com/isseium/items/20eb6802898d9b1ba2b4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100,a | |
200,b | |
400,c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200,x | |
300,y | |
500,z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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