#!/usr/bin/perl
use IO::File;
$inputfn=(($ARGV[0] ne '')?$ARGV[0]:"hosts.txt");
print "Parsing file: $inputfn\n";
#GET "http://www.liveinternet.ru/stat/site.ru/index.html?period=month;total=yes" | grep -A 1 id_8 | tail -1 | perl -e '<>=~/\>(\d+)\</;print $1;print "\n";'
#counter end
$ce=(($ARGV[1] ne '')?$ARGV[1]:"0");
my $c = 0;
open(F, $inputfn) or die $!;
while ($a=<F>)
{
$a = trim ($a);
if ($a ne "")
{
$req='GET "http://www.liveinternet.ru/stat/';
$req.=$a;
$req.='/index.html?period=month;total=yes" | grep -A 2 id_8 | tail -1';
#print ($req);
$str=`$req`;
$str=~m/\>([\d.,]+)\0 && $c >= $ce);
}
close F;
# Perl trim function to remove whitespace from the start and end of the string
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
среда, 17 августа 2011 г.
parse liveinternet.ru
Подписаться на:
Комментарии к сообщению (Atom)
Комментариев нет:
Отправить комментарий