I have 2 text files from which i need to remove duplicates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dirty F
    Too lazy to set a custom title
    • Jul 2001
    • 59204

    #1

    I have 2 text files from which i need to remove duplicates

    I have 2 text files with names.
    One is a big list with xxxx amount of names and the text file is a small list with xxx amount of names. The smaller list names also appear on the bigger list. Now i need a way to compare both list and remove ALL the names that appear on both lists.

    Know what i mean?
  • Lace
    Too lazy to set a custom title
    • Mar 2004
    • 16116

    #2
    get a list manager...
    Your Paysite Partner
    Strength In Numbers!
    StickyDollars | RadicalCash | KennysPennies | HomegrownCash

    Comment

    • Voodoo
      ♥ ♦ ♣ ♠
      • Sep 2002
      • 10600

      #3
      http://www.flashpeak.com/slimlist/slimlist.htm

      "I'm selflessly supporting the common good, but only coincidentally looking out for No.1."

      Comment

      • Dirty F
        Too lazy to set a custom title
        • Jul 2001
        • 59204

        #4
        I have list managers but they can only remove the duplicates and not the original name as well. I want any duplicate name to be gone. So it doesnt appear at all on the list anymore.

        Comment

        • Voodoo
          ♥ ♦ ♣ ♠
          • Sep 2002
          • 10600

          #5
          SlimList will remove duplicate entries, but only the duplicate.

          Are you looking to do something like this:
          LIST A: name1 name2 name3 name4
          LIST B: name1 name5 name6 name7

          ACTION: remove name1 from both lists.

          Is that what you're talking about? Or simply removing duplicates?

          "I'm selflessly supporting the common good, but only coincidentally looking out for No.1."

          Comment

          • ne0
            Confirmed User
            • May 2006
            • 781

            #6
            Originally posted by Dirty F
            I have 2 text files with names.
            One is a big list with xxxx amount of names and the text file is a small list with xxx amount of names. The smaller list names also appear on the bigger list. Now i need a way to compare both list and remove ALL the names that appear on both lists.

            Know what i mean?
            if the names are one per line, and they appear the same way on the first and the second list, you can do this using a *nix server:
            cat list1.txt list2.txt |sort |uniq > list3.txt
            the list3.txt will contain both lists, ordered and without the dupes.
            hai2u

            Comment

            • Lace
              Too lazy to set a custom title
              • Mar 2004
              • 16116

              #7
              Or you could throw it in a XLS, sort and remove by hand.
              Your Paysite Partner
              Strength In Numbers!
              StickyDollars | RadicalCash | KennysPennies | HomegrownCash

              Comment

              • Dirty F
                Too lazy to set a custom title
                • Jul 2001
                • 59204

                #8
                I dont see how this can do what i need.

                Comment

                • Dirty F
                  Too lazy to set a custom title
                  • Jul 2001
                  • 59204

                  #9
                  Originally posted by Lace
                  Or you could throw it in a XLS, sort and remove by hand.
                  If i would want to do it by hand i wouldnt ask for a solution here

                  Comment

                  • moogle
                    Confirmed User
                    • Sep 2007
                    • 314

                    #10
                    http://www.download.com/Duplicate-Te...html?tag=lst-1



                    Comment

                    • Dirty F
                      Too lazy to set a custom title
                      • Jul 2001
                      • 59204

                      #11
                      Its the same as others posted. A duplicate content remover. Its not what i need.
                      Last edited by Dirty F; 12-21-2007, 09:18 AM.

                      Comment

                      • Zoose
                        Confirmed User
                        • Aug 2006
                        • 268

                        #12
                        Code:
                        <?php
                        
                        $list1 = file( "list1.txt" );
                        $list2 = file( "list2.txt" );
                        
                        for( $i=0; $i<count($list2); $i++ ){
                        
                        if( in_array( $list2[$i], $list1 ) ){ /* do nothing */ } else { $new_array[] = $list2[$i]; }
                        
                        }
                        
                        echo "<pre>";
                        print_r( $new_array );
                        echo "</pre>";
                        
                        ?>

                        Comment

                        • Dirty F
                          Too lazy to set a custom title
                          • Jul 2001
                          • 59204

                          #13
                          Originally posted by Zoose
                          Code:
                          <?php
                          
                          $list1 = file( "list1.txt" );
                          $list2 = file( "list2.txt" );
                          
                          for( $i=0; $i<count($list2); $i++ ){
                          
                          if( in_array( $list2[$i], $list1 ) ){ /* do nothing */ } else { $new_array[] = $list2[$i]; }
                          
                          }
                          
                          echo "<pre>";
                          print_r( $new_array );
                          echo "</pre>";
                          
                          ?>
                          Totally appreciate it. Even more if it was 2 mins earlier before i paid someone 25 bucks for the same thing

                          Comment

                          • UniqueD
                            Confirmed User
                            • Aug 2004
                            • 1022

                            #14
                            paste into excel and run a macro to remove duplicates, do a google search for excel remove dupes.

                            Comment

                            Working...