Created
June 6, 2009 05:53
-
-
Save jjgod/124712 to your computer and use it in GitHub Desktop.
To combine 2 files by column with first column in the first file
This file contains 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
import sys | |
k = {} | |
for line in open(sys.argv[1]): | |
k[line.split()[0]] = line | |
for line in open(sys.argv[2]): | |
col = line.split()[0] | |
if col in k: | |
print k[col][:-1], line[:-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment