- 论坛徽章:
- 0
|
回复 1# shot
另外 还有通过perl写的结果:
#!/usr/bin/perl -w
use strict;
#my $date=qx/date --date="1 week ago"|awk '{print \$1,\$2,\$3}'/;
#my $today=qx/date|awk '{print \$1,\$2,\$3}'/;
#my $today="Thu Jun 10";
#print "$today";
#print "$date";
open LOG,"vsftpd.log";
open RES,"+>result.log";
my @m=<LOG>;
close LOG;
#print @m,"\n";
#my @m={};
#while (<LOG>){
# shift;
# @m=split(/\s/,$_);
# print $m[7],"\n";
# print if $_ =~ /$date/,/$today$/;
# }
my @y=
#join "\t",
map{$_->[1],"\t",$_->[2],"\t",$_->[3],"\n"}
reverse sort {$a->[1]<=>$b->[1]}
map { [$_,(split)[7],(split)[8],(split)[13]]} @m;
print RES @y;
seek(RES,0,0);
while(<RES>){
print if $.<11;
}
写了一部分实现,邮件的话可以通过sendmail 的发,利用SMTP模块,本人觉得还是脚本的简单啊 |
|