Skip to content

Instantly share code, notes, and snippets.

@c7h
Created December 9, 2015 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c7h/4083dc2d89feebdefcd2 to your computer and use it in GitHub Desktop.
Save c7h/4083dc2d89feebdefcd2 to your computer and use it in GitHub Desktop.
logfile evaluation
#!/usr/bin/perl
my $user_c = 0;
my $user_min = 0;
my @ip = ();
while(<>) {
if (m/(^\w+).*(\d{2}:\d{2})/) {
if ($1 eq 'christoph'){
$user_c++; # user_zaehler erhöhen
$user_min =+ $2
}
}
if (m/((?:\d{1,3}\.){3}\d{1,3})/){
#ip-addressen
push @ip, $1;
}
}
#fertig
print "IP-Adressen:\n";
foreach (@ip){
print $_."\n";
}
print "ipsarray @ip";
print "\n";
print "user christoph war $user_c mal angemeldet ($user_min lang)\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment