Herzlich willkommen im Archiv vom ABAKUS Online Marketing Forum
Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.
Code: Alles auswählen
#!/usr/bin/perl
# Webalizer Daily Statistics Grepper
# Copyright (C) 2004 Robert Boeck
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$version = "v1.0";
$program = "Webalizer Daily Statistics Grepper $version";
$copyright = "Copyright (C) 2004 Robert Boeck";
$infile = '';
$alldays = 0;
&print_copyright;
&getparams;
@infiles = glob ($infile);
foreach (@infiles) {
print STDERR $_."\n";
print &get_daily ($_);
print "\n";
}
print STDERR $alldays." Days\n";
sub get_daily {
my $infile = shift;
open (IN, $infile) or die "Error: $!\n";
@lines = <IN>;
close (IN);
chomp (@lines);
$lines = join (' ', @lines);
$lines =~ /(Daily Statistics for .*?)<\/TABLE>/;
$daily = $1;
$daily =~ s/\t/ /g;
$daily =~ s/<\/TR>/\n/g;
$daily =~ s/<\/TD>/\t/g;
$daily =~ s/<[^>]+>/ /g;
$daily =~ s/ +/ /g;
$daily =~ s/\n\s+/\n/g;
$daily =~ s/\s+\n/\n/g;
$days = ($daily =~ tr/%/%/) / 6;
$alldays += $days;
return $daily;
}
sub getparams {
if ($#ARGV < 0) {
die "usage: stat_grep.pl <statfile.html>\n\n";
}
foreach my $arg (@ARGV) {
if (! $infile) { $infile = $arg; }
else { die "unknown parameter: $arg\n"; }
}
}
sub print_copyright {
print STDERR "\n$program, $copyright\n";
print STDERR "This program is free software and comes with ABSOLUTELY NO WARRANTY;\n";
print STDERR "see the source code for details.\n\n";
}
Hmmm ... das Script ist auch nicht für den Server gedacht, sondern eher für die User, die damit ganz einfach aus ihren lokalen oder heruntergeladenen Webalizer-Statistiken die benötigte Textliste erstellen können.chio hat geschrieben:@robo: alles was Rechte auf dem Server braucht, ist mir ein Rätsel.... aber sicher können andere was damit anfangen.
Code: Alles auswählen
unknown parameter: usage_200211.html
Code: Alles auswählen
perl /root/makestats.pl usage*.html
Habe jetzt auch erst eine Weile nachdenken müssen. Aber ich habe das Problem erkannt. Du nutzt das Script unter Linux, und dort löst die bash bereits das usage*.html auf. Umgehen kannst du das, indem du den Parameter in Anführungszeichen setzt:-robert- hat geschrieben:bekomme leider bei der Nutzung deines Scripts einen::
Code: Alles auswählen
unknown parameter: usage_200211.html
Sehe den Fehler aber nicht. Ich rufe es über
Woran könnte es liegen?Code: Alles auswählen
perl /root/makestats.pl usage*.html
Code: Alles auswählen
perl /root/makestats.pl "usage*.html"
Ich verzeih' dir noch einmal.chio hat geschrieben:@robo: Sorry, dass ich "den Fuchs in dir" nicht erkannt habePerl ist so gar nicht meins.
klar, warum nicht?chio hat geschrieben:Könnten sich da Synergien ergeben?