Originally Posted by bugg_deccan
I want to read a number(s) in a file and check for same number(s) in another file.
Not sure if you have multiple lines in the first file or not. If you do, here's a small python solution for it.
file1 = dict(line.strip().split(',',1) for line in open(sys.argv))
file2 = dict(line.strip().split(',',1) for line in open(sys.argv))
for x in set(file1) & set(file2):
print ','.join([x, file1[x], file2[x]])
python compare.py test1.txt test2.txt
This will work if you have multiple lines in both files and you need to compare them all.
This program makes two assumptions (cause I'm lazy):
1. The files aren't some sort of huge files that will fill up all your ram. (stores files in memory)
2. There are 4 numbers on each line, not more.
Both are easy fixes, so if you need them just ask.