jjgod (owner)

Revisions

gist: 124712 Download_button fork
public
Description:
To combine 2 files by column with first column in the first file
Public Clone URL: git://gist.github.com/124712.git
combine.py
1
2
3
4
5
6
7
8
9
10
11
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]