Dear friends,
I need again your help for a new challenge ;)
I have a number of files with 5 columns of values (comma separated). I would like to find a way to the values in the first 2 columns and compare them with the first 2 columns of the next file and when they match I need to print (or save to file) the complete line in first and second file.
I guess an example will make things easier.
File1
82647.675915,138208.736325,1618.72,-1195.28,1
82642.4095612,138203.777175,686.08,-1420.4,1
82648.3342092,138212.949408,1918.88,-921.92,1
82647.1053933,138211.193956,1704.48,-996.96,1
82646.5787579,138209.657937,1554.4,-1093.44,1
82649.38748,138210.316231,1908.16,-1109.52,1
82643.6822634,138204.962104,927.28,-1372.16,1
82645.2621695,138208.824097,1361.44,-1109.52,1
82641.8829258,138202.504473,519.92,-1511.52,1
...
FileN
82647.1053933,138211.193956,180.48,-22.96,1
82646.5787579,138209.657937,54.4,-55.44,1
82645.38748,138210.316231,2010.6,-809.52,1
...
So I will take 82647.675915,138208.736325 first 2 columns from the first file and compare it with of 82647.1053933,138211.193956 then 82646.5787579,138209 then 82649.38748,138210.316231 of FileN.
In the above example, the result should be:
File1
82647.1053933,138211.193956,1704.48,-996.96,1
82646.5787579,138209.657937,1554.4,-1093.44,1
File N
82647.1053933,138211.193956,180.48,-22.96,1
82646.5787579,138209.657937,54.4,-55.44,1
I will need to make the comparison of File1 with File2, File2 with File3 and so on.
Thank you for your precious help,
Gianluca