init III
This commit is contained in:
53
Perl EMA Logfile/ema.pl
Normal file
53
Perl EMA Logfile/ema.pl
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/perl
|
||||
# ID;Account;Direction;DocType;SubType;Size;From;To;CC;Subject;SentTime;ReceivedTime;ArchiveTime;MessageID
|
||||
$|=1;
|
||||
|
||||
if ($ARGV[1] eq "") {
|
||||
print "$0 Input Output\n";
|
||||
exit;
|
||||
}
|
||||
print "Eingabe " . $ARGV[0] . "\n";
|
||||
print "Ausgabe " . $ARGV[1] . "\n";
|
||||
print "\n";
|
||||
|
||||
open IN, "<$ARGV[0]";
|
||||
@INA=<IN>;
|
||||
$count=@INA;
|
||||
close IN;
|
||||
open OUT, ">$ARGV[1]";
|
||||
|
||||
$liner = 0;
|
||||
$linew = 0;
|
||||
|
||||
foreach (@INA) {
|
||||
chomp;
|
||||
$liner++;
|
||||
printf "\r [%d/%d] %05.2f\%, %d geschrieben", $liner, $count, $liner/$count*100, $linew;
|
||||
($id,$account,$direction,$doctype,$subtype,$size,$from,$to,$cc,$subject,$senttime,$receivedtime,$archivetime,$messageid) = split /;/,$_;
|
||||
$unique = $senttime . $messageid;
|
||||
$rein = 0;
|
||||
if ($messageid eq "\"\"") {
|
||||
$rein = 1;
|
||||
} else {
|
||||
$found = 0;
|
||||
foreach (@uniques) {
|
||||
if ($_ eq $unique) {
|
||||
$found = 1;
|
||||
}
|
||||
}
|
||||
if ($found == 1) {
|
||||
$rein = 0;
|
||||
} else {
|
||||
push @uniques, $unique;
|
||||
$rein = 1;
|
||||
}
|
||||
}
|
||||
if ($rein == 1) {
|
||||
print OUT "$id;$account;$direction;$doctype;$subtype;$size;$from;$to;$cc;$subject;$senttime;$receivedtime;$archivetime;$messageid\n";
|
||||
$linew++;
|
||||
}
|
||||
$c=@uniques;
|
||||
shift @uniques if ($c>100);
|
||||
}
|
||||
print "\n";
|
||||
close OUT;
|
||||
Reference in New Issue
Block a user