compare columns of two unsorted file in python....specific output required -


i have 2 pipe delimited files large data...need compare columns..i column primary key......

eg. one.dat

123|ny|aa|500 569|ny|a|450 777|ok|b|250 899|ok|c|100 

two.dat

569|ny|a+|500 777|ok|a|350 899|ok|b|150 

output should like:

ny  column3 1 ny  column4 1 ok  column3 2 ok  column3 2 

it means ny records... column iii has 1 difference matched records..for ok records...column 3 has 2 differennces matched records....

i want join 2 files on column primary key , compare columns.

please me out :)

if files sorted, bits of example show are, can in way similar merge phase of merge sort:

  1. you start simultaneously @ beginning of 2 files , read row each.
  2. if primary keys match, compare them , output difference rows want.
  3. if not, see of them has lesser key , move on next row in file.
  4. repeat 2 or 3 until you've reached end of 1 of files.

if files aren't sorted, sort them primary key first.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -