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.

VulpesRank #55 · 29.2K reputationPosted Dec 29, 2014, 3:09 AM EST
Try something like this.
I've assumed that each section will consist of the header plus 4 more lines:
VulpesRank #55 · 29.2K reputationPosted Dec 24, 2014, 1:59 AM EST
TAN WhoAMIRank #5,790 · 286 reputationPosted Dec 28, 2014, 2:41 PM EST
Step 1:
Copy all files from source directory#1 to target directory -- completed.
Step 2:
Conversion factor needed for files on target directory: e.g -- completed.
becomes
Step 3 is what I am stuck:
Now, there is another source directory#2 which is similar to source directory#1, but contains something new. Example, it contains
I need those new contents (highlighted in red) from source directory#2 to be copied to the files in the target directory. The files in source directory#2 and target directory are having the same filenames.
TAN WhoAMIRank #5,790 · 286 reputationPosted Dec 29, 2014, 3:34 AM EST