Tapatalk

Compare and remove duplicates from files with non synchronous lines

Compare and remove duplicates from files with non synchronous lines

7
NewbieNewbie
7

    Sep 28, 2022#1

    Does anyone have a way of using UE or UC to find and remove duplicates in two separate files where the line numbers/placements of duplicates are not in line with each other? I have attached a couple of sample files of what I am describing. Thank you.
    barebonesV2.xml (32.25 KiB)   3
    barebonesV1.xml (34.02 KiB)   2

    6,685587
    Grand MasterGrand Master
    6,685587

      Sep 29, 2022#2

      What exactly do you mean?

      Should there all lines within the XML element config in file barebonesV1.xml looked up also in XML element config in file barebonesV2.xml and if a line (element) exits in both files removed from both files without changing the order of the lines (elements) existing only in one of the two files?

      That could be done easily using an UltraEdit script. How to code the script depends on how large are the XML files usually. Must the script support XML files with hundreds of MB or always with just of some KB up to about 4 MB?
      Best regards from an UC/UE/UES for Windows user from Austria

      7
      NewbieNewbie
      7

        Sep 29, 2022#3

        Hey Mofi, thanks for the reply. It is just a one-time thing, and with these files that I have provided. You are correct, I just want to search each file and if the  XML tag of <Pxxxx> and it's contents are the same in each file then remove them from both so that all that is left are the differences, be it a <Pxxxx> tag that exists in one file but not the other, or that they exist in both, but the contents is different. Hopefully that makes it a little more clear.

        6,685587
        Grand MasterGrand Master
        6,685587

          Sep 29, 2022#4

          The attached ZIP file contains a very quick and very dirty coded UltraEdit script executed with the two XML files opened which were saved manually and also compressed into the ZIP file. The script does not check if an element exists more than once in one of the two files.
          remove_duplicates.zip (4.82 KiB)   1
          ZIP file with the UltraEdit script and the two resulting files.
          Best regards from an UC/UE/UES for Windows user from Austria

          7
          NewbieNewbie
          7

            Sep 29, 2022#5

            Mofi, this is perfect!! Thank you so much! And there should have only been unique elements, so there would not have been duplicates in the same file. Thanks again!!