Hello, @n0stal6ic, @terry-r and All,
I wanted to point out that, if the numbering is identical between the two files, a simple regex S/R, on file 1, should be enough.
So, no need about a file 2, containing the new values, no need of a temporary file 3 and so on !
For instance, given the file 1 INPUT text, below :
<Placemark>
<name>NAME-1</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>NAME-2</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>NAME-3</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>NAME-4</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
Then the regex S/R, below, applied to file 1 :
SEARCH <name>\KNAME-(\d+)(?=</name>)
REPLACE NAME \1
would produce this text :
<Placemark>
<name>NAME 1</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>NAME 2</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>NAME 3</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>NAME 4</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
A second example, with an other regex S/R :
SEARCH <name>\KNAME-(\d+)(?=</name>)
REPLACE ABC-\1-XYZ
which would give this text :
<Placemark>
<name>ABC-1-XYZ</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>ABC-2-XYZ</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>ABC-3-XYZ</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>ABC-4-XYZ</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
Now, if I assume that your file 1 contains only four values ( 1, 12, 123 and 1234 ), here is a last example with a third regex S/R :
SEARCH <name>\KNAME-(\d+)(?=</name>)
REPLACE {_000\1_}
You’re left with that text :
<Placemark>
<name>{_0001_}</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>{_00012_}</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>{_000123_}</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
<Placemark>
<name>{_0001234_}</name>
<styleUrl>Stuff</styleUrl>
<Point>
<coordinates>
Stuff
</coordinates>
</Point>
</Placemark>
Note that only the Replace regex is different, in each example !
Of course, if mathematical operations must occur on values, in file 1, in order to get new values, the regex approach is useless and needs scripting !
Best Regards,
guy038