projects
/
mx01
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
41aaf90
)
sort correctly by date number, ignore some lines
klin
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 23 Sep 2016 17:24:34 +0000
(19:24 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 23 Sep 2016 17:24:34 +0000
(19:24 +0200)
klin/from-by-time.pl
patch
|
blob
|
history
diff --git
a/klin/from-by-time.pl
b/klin/from-by-time.pl
index
332362a
..
0342043
100755
(executable)
--- a/
klin/from-by-time.pl
+++ b/
klin/from-by-time.pl
@@
-11,6
+11,7
@@
while(<>) {
my ( $mon, $dd, $time, $host, $daemon, $msg ) = split(/\s+/,$_,6);
next unless $msg =~ m/from=<([^>]+)>/;
my ( $mon, $dd, $time, $host, $daemon, $msg ) = split(/\s+/,$_,6);
next unless $msg =~ m/from=<([^>]+)>/;
+ next if $msg =~ m/(NOQUEUE|FILTER)/;
my $from = $1;
my $t = $time;
my $from = $1;
my $t = $time;
@@
-25,17
+26,18
@@
while(<>) {
#warn "# stat = ", dump( $stat );
foreach my $mon ( sort keys %$stat ) {
#warn "# stat = ", dump( $stat );
foreach my $mon ( sort keys %$stat ) {
- foreach my $dd ( sort keys %{$stat->{$mon}} ) {
+ foreach my $dd ( sort
{ $a <=> $b }
keys %{$stat->{$mon}} ) {
foreach my $t ( sort keys %{ $stat->{$mon}->{$dd} } ) {
my $n = 0;
my $e = $stat->{$mon}->{$dd}->{$t};
foreach my $t ( sort keys %{ $stat->{$mon}->{$dd} } ) {
my $n = 0;
my $e = $stat->{$mon}->{$dd}->{$t};
+ my $fmt = "%3s %2s %5s %4d %s\n";
foreach my $email ( sort { $e->{$b} <=> $e->{$a} } keys %$e ) {
if ( $n == 0 ) {
foreach my $email ( sort { $e->{$b} <=> $e->{$a} } keys %$e ) {
if ( $n == 0 ) {
- printf
"%3s %2s %5s %d %s\n"
, $mon, $dd, $t, $e->{$email}, $email;
+ printf
$fmt
, $mon, $dd, $t, $e->{$email}, $email;
} elsif ( $n == 5 ) { # XXX top
last;
} else {
} elsif ( $n == 5 ) { # XXX top
last;
} else {
- printf
"%3s %2s %5s %d %s\n"
, '', '', '', $e->{$email}, $email;
+ printf
$fmt
, '', '', '', $e->{$email}, $email;
}
$stat->{_from}->{$email} += $e->{$email};
$n++;
}
$stat->{_from}->{$email} += $e->{$email};
$n++;
@@
-44,6
+46,7
@@
foreach my $mon ( sort keys %$stat ) {
}
}
#print "_from = ",dump( $stat->{_from} );
}
}
#print "_from = ",dump( $stat->{_from} );
+print "# XXX count,email\n";
foreach my $email ( sort { $stat->{_from}->{$b} <=> $stat->{_from}->{$a} } keys %{ $stat->{_from} } ) {
printf "%4d %s\n", $stat->{_from}->{$email}, $email;
}
foreach my $email ( sort { $stat->{_from}->{$b} <=> $stat->{_from}->{$a} } keys %{ $stat->{_from} } ) {
printf "%4d %s\n", $stat->{_from}->{$email}, $email;
}