匹配服务器

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/usr/bin/perl -w

sub usage(){
	print "\n";
	print "Usage : perl extract_host.pl <filename> <output file>\n";
	print "\n";
}

sub check($$){
	if($_[0] eq '--help'){
		&usage();
		exit 0;
	}

	if(not $_[0] or not $_[1]){
		&usage();
		exit 1;
	}

	if(not -e $_[0]){
		print "FILE : $ARGV[0] don't exit !\n";
		exit 1;
	}
}

&check($ARGV[0], $ARGV[1]);

my $file = $ARGV[0];
my $out = $ARGV[1];

open(FH, "<$file");
open(BH, ">$out");

while(<FH>){
    if($_ =~ s/.*[^\w\d]([\w\d]+\-[\w\d]+\-[\w\d]+\.[\w\d]+).*/$1/g){
        print BH $_ ;
    }
}

close(FH);
close(BH);

`cat $out | sort | uniq > $out`;
print "$out Created !\n"
exit 0