Damn Duplicates -- p00f begone!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Barry-xlovecam
    It's 42
    • Jun 2010
    • 18083

    #1

    Damn Duplicates -- p00f begone!

    I wrote a fast file cleaner the grep use is interesting ...
    Clean your lists up, etc. ...

    Code:
    #!/usr/bin/perl
    ####################################
    # nodupes.cgi
    #you may use free as-is with  no warranty
    #make the outfile's chmod 666 if using the webserver
    #chmod this script to 755
    ####################################
    use CGI::Carp qw/fatalsToBrowser/;
    use CGI qw/:standard/;
    
    print "Content-type: text/html\n\n";
    
    my $query = "$ENV{'QUERY_STRING'}";
    	if ($query =~ s/[^a-zA-Z0-9\_]//g) {print qq~HUH???~;       exit;}
    
    my $infile="somesiteurl.txt";
    my $outfile="somesiteurlduped.txt";
    
       open(INPUT, "<", $infile) || die "infile not found\n";
          my @array=(<INPUT>);
       open(OUTPUT, ">>",$outfile )|| die "outfile not found\n";
    
    
             [COLOR="Yellow"]my %seen = ();
             my @unique = grep { ! $seen{ $_ }++ } @array;[/COLOR]
    
                foreach my $unique(@unique){
                      chomp $unique;
                      print OUTPUT "$unique\n"
                        }
    
    close OUTPUT;
    close INPUT;
    Last edited by Barry-xlovecam; 02-11-2012, 10:39 AM.
  • V_RocKs
    Damn Right I Kiss Ass!
    • Nov 2003
    • 32467

    #2
    Nice.... reminds me of 2000...

    Comment

    • mikke
      Confirmed User
      • Jan 2010
      • 1327

      #3
      can you port it to brainfuck?
      icq: 395 294 346
      http://www.adultsubmitter.eu - submit any adult site to 20 directories from 1 form!
      now 20 domains!
      http://www.porndeals.eu http://www.ebonybangbros.com

      Comment

      • Barry-xlovecam
        It's 42
        • Jun 2010
        • 18083

        #4
        Originally posted by mikke
        can you port it to brainfuck?
        Something understandable ...

        Comment

        • fris
          I have to go potty
          • Aug 2002
          • 55956

          #5
          Originally posted by Barry-xlovecam
          Something understandable ...
          or you could just use cat file.txt | sort -u

          ;)

          much quicker
          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


          Only Fans Data

          20+ Custom Adult Themes and Plugins

          Comment

          • Barry-xlovecam
            It's 42
            • Jun 2010
            • 18083

            #6
            Code:
            cat infile.txt|sort -u > outfile.txt
            No spaces and the outfile

            That is a lot easier fris, ty

            Comment

            • alextokyo
              So Fucking Banned
              • Sep 2011
              • 975

              #7
              Someone said something about a poof?


              Comment

              • Barry-xlovecam
                It's 42
                • Jun 2010
                • 18083

                #8
                p00f not poof -- comprehension problems?

                Comment

                • fris
                  I have to go potty
                  • Aug 2002
                  • 55956

                  #9
                  Originally posted by Barry-xlovecam
                  Code:
                  cat infile.txt|sort -u > outfile.txt
                  No spaces and the outfile

                  That is a lot easier fris, ty
                  awk way to do it, to remove dups without sorting

                  Code:
                  awk '!x[$0]++' file.txt
                  perl without sorting

                  Code:
                  perl -ne 'print if !$a{$_}++'
                  this would remove dupe entries on a file with a single column

                  awk

                  Code:
                  awk '{ if ($1 in stored_lines) x=1; else print; stored_lines[$1]=1 }' infile.txt > outfile.txt
                  perl

                  Code:
                  perl -ane 'print unless $x{$F[0]}++' infile > outfile
                  sunday gfy bonus

                  count and show duplicate file names

                  Code:
                  find . -type f  |sed "s#.*/##g" |sort |uniq -c -d
                  extra bonus

                  fild duplicate files based on filesize, then md5 hash

                  Code:
                  find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
                  Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


                  Only Fans Data

                  20+ Custom Adult Themes and Plugins

                  Comment

                  Working...