Hi all, Sorry for asking such a basic question butI am trying to merge two files(file1 and file2) and do some stuff. Merge the two files by the first column(key). Here is the description of files and what I would like to do.
file1 key c1 c2 1 759 939 2 345 154571 3 251 350711 4 3749 22159 5 676 76953 6 46 756 file2 key p1 p2 1 759 939 2 345 154571 3 251 350711 4 3915 23254 5 7676 77953 7 256 4562 create file3 a) merge the two files by (key) that exit in file1 and file2 b) create two variables dcp1 = c1- p1 and dcp2= c2-p2 c) sort file3 by dcp2(descending) and output create file4:- which exist in file1 but not in file2 create file5:- that exist in file2 but not in file1; Desired output files file3 key c1 c2 p1 p2 dcp1 dcp2 4 3749 22159 3915 23254 -166 -1095 5 676 76953 7676 77953 -7000 -1000 1 759 939 759 939 0 0 2 345 154571 345 154571 0 0 3 251 350711 251 350711 0 0 file4 key c1 p1 6 46 756 file5 key p1 p2 7 256 4562 Thank you in advance -- https://mail.python.org/mailman/listinfo/python-list