#!/usr/bin/perl
#
use strict;
use warnings;
open MIRRORS, "/home/me/mirrorlist";
my $i = 0;
while (
if (/(Server.*)/) {
print "$1\n";
}
}
close MIRRORS;
i then ./mirrors.pl > mymirrorlist
and rankmirrors -n 6 mymirrorlist > mirrorlist
tada!
[EDIT]
this can even run better like this, i just learnt to do subs, so
#!/usr/bin/perl
#
use strict;
use warnings;
open MIRRORS, "/home/tehpwnz/perl/mirrorlist";
open MYLIST, ">/home/tehpwnz/perl/list";
my $i = 0;
while (
#if(/[#]Server.*(http|ftp)/) {
# print "found";
#}
if (/(Server.*)/) {
s/#//;
print MYLIST;
}
}
close MIRRORS;
close MYLIST;
never mind the $i=0 part, that was for debugging something i just forgot to remove it :(
ReplyDelete