Hi,
I'm trying to use diff with the "-I regexp" option but it doesn't work as it should.
I have two files and I want to modify one of them but leave some of the lines unchanged.
File "input.xml" is a file that from time to time gets modfied.
Code:
<root>
<group>
<name>some name 1</name>
<custom>some default text 1</custom>
<missing>some other text 1 missing from template</missing>
</group>
<group>
<name>some name 2</name>
<custom>some default text 2</custom>
<missing>some other text 2 missing from template</missing>
</group>
</root>
File "template.xml" is a file created based on "input.xml" and should be updated every time "input.xml" is changed.
Code:
<root>
<group>
<name>some name 1</name>
<custom>some custom text 1</custom>
</group>
<group>
<name>some name 2</name>
<custom>some custom text 2</custom>
</group>
</root>
diff has the -I switch to ignore lines matching a reg-expression but running
Code:
diff input.xml template.xml -I custom
does not exclude the custom tags and they are overwritten.
The desired new template.xml whould be:
Code:
<root>
<group>
<name>some name 1</name>
<custom>some custom text 1</custom>
<missing>some other text 1 missing from template</missing>
</group>
<group>
<name>some name 2</name>
<custom>some custom text 2</custom>
<missing>some other text 2 missing from template</missing>
</group>
</root>
with "custom" tag untouched and the "missing" tag added.
Thanks