I have numerous .vrt files with a pattern in the file name from a directory:
Data2016001045000.level1_level2.newDATA_main.vrt
Data2016002055000.level1_level2.newDATA_main.vrt
and so on . . .
and the content of the files looks like this:
<Insert="Line 1">
<Insert="Line 2">file1.vrt</Line2>
<Insert="Line 2">1</Line2>
<Insert="Line 3">file2.vrt</Line3>
<Insert="Line 3">1</Line3>
<Another line="Line 4">0</Line4>
</Insert>
In this line, "file1.vrt" should be replaced with the file that I want to insert from another directory. The file that should be inserted in here should be the same as the file name above but will only differ in the last part of the file name: Data2016001045000.level1_level2.newDATA _abc.vrt.
<Insert="Line 2">file1.vrt</Line2>
In this line, "file2.vrt" should be replaced with the file that I want to insert from another directory. The file that should be inserted in here should be the same as the file name above but will only differ in the last part of the file name: Data2016001045000.level1_level2.newDATA _def.vrt.
<Insert="Line 3">file2.vrt</Line3>
The output should be like this:
<Insert="Line 1">
<Insert="Line 2">C:\path\to\file\Data2016001045000.level1_level2.newDATA_abc.vrt</Line2>
<Insert="Line 2">1</Line2>
<Insert="Line 3">C:\path\to\file\Data2016001045000.level1_level2.newDATA_def.vrt</Line3>
<Insert="Line 3">1</Line3>
<Another line="Line 4">0</Line4>
</Insert>
That means there is an equivalent *.newDATA_abc and *.newDATA_def to be inserted in every *.newDATA_main.vrt file, . So that in every run of the batch file the newDATA_abc and newDATA_def will be included in processing the *newDATA_main.vrt files.