TAN WhoAMI

TAN WhoAMI

  • NA
  • 291
  • 0

Compare and update file contents in folders (source,target)

Dec 22 2014 10:20 PM
I have 2 directories (source, target) which contain multiple files with the same filenames, e.g 001.txt, 002.txt, 003.txt... and so on
for example on the source directory with this 001.txt file 
 
[ZERO_POINT_004]
X=0.000000
Y=52000.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_005]
X=-38000.000000
Y=52000.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_006]
X=-76000.000000
Y=52000.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_LEFT_001]
X=0.000000
Y=0.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_LEFT_002]
X=-38000.000000
Y=0.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_LEFT_003]
X=-76000.000000
Y=0.000000
Z=50827.000000
ZD=38530.000000
and on the target directory with this 001.txt file  
[ZERO_POINT_004]
X=0.000000
Y=52000.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_005]
X=-38000.000000
Y=52000.000000
Z=50827.000000
ZD=38530.000000
[ZERO_POINT_006]
X=-76000.000000
Y=52000.000000
Z=50827.000000
ZD=38530.000000
 
Notice that the file in the target directory contain information similar to that from the source directory, but less those highlighted in red. How do I copy the contents difference (in Red color) to the file in the target directory? The contents difference copied over must be on the same lines as what the file in the source directory.

Answers (4)