Skip to content

Instantly share code, notes, and snippets.

@jjgod
Created June 6, 2009 05:53
Show Gist options
  • Save jjgod/124712 to your computer and use it in GitHub Desktop.
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
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