On Mon, 23 Oct 2023 15:20:42 +0100 Mark Rogers mark@more-solutions.co.uk allegedly wrote:
This has been driving me mad all afternoon.
How can I compare xml files from the commandline?
Specifically: If I have two XML files and one contains: ... <field name="A">ValueA</field> <field name="B">ValueB</field> ... and the other contains: ... <field name="B">ValueB</field> <field name="A">ValueA</field> ...
... then I consider those two files to be the same, but obviously a diff will not. How can I compare just the content and not the ordering/formatting/etc?
Mark
Try "sorting" the files before the diff.
i.e.
sort one.txt > sortedone.txt sort two.txt > sortedtwo.txt
diff sortedone.txt sortedtwo.txt
Mick
--------------------------------------------------------------------- Mick Morgan gpg fingerprint: FC23 3338 F664 5E66 876B 72C0 0A1F E60B 5BAD D312 blog: baldric.net ---------------------------------------------------------------------