Is it also possible to ignore some duplicate lines while removing other duplicates from an xml file, example: if my abx.xml is CODE:
@echo off
setlocal disableDelayedExpansion
set "file=%~1"
set "line=%file%.line"
set "deduped=%file%.deduped"
::Define a variable containing a linefeed character
set LF=^
::The 2 blank lines above are critical, do not remove
>"%deduped%" (
for /f usebackq^ eol^=^%LF%%LF%^ delims^= %%A in ("%file%") do (
set "ln=%%A"
setlocal enableDelayedExpansion
>"%line%" (echo !ln:\=\\!)
>nul findstr /xlg:"%line%" "%deduped%" || (echo !ln!)
endlocal
)
)
>nul move /y "%deduped%" "%file%"
2>nul del "%line%"
Only BATCH SCRIPT PLEASE.
<bookstores>
<book id="parent">
<name="it1"/>
<name="it1"/>
<name="it2"/>
</book>
<book id="child">
<name="it1"/>
<name="it1"/>
<name="it2"/>
<name="it3"/>
</book>
</bookstores>
Output should be:
<bookstores>
<book id="parent">
<name="it1"/>
<name="it2"/>
</book>
<book id="child">
<name="it3"/>
</book>
</bookstores>
But the output i am getting is:
NOTE: </book>
tag is removed.
<bookstores>
<book id="parent">
<name="it1"/>
<name="it2"/>
</book>
<book id="child">
<name="it3"/>
</bookstores>
I have searched couple of simillar requests but most of them are deleting all duplicate lines,but not sure how to ignore some duplicate lines: