This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

53
Perl EMA Logfile/ema.pl Normal file
View 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;

90
Perl EMA Logfile/ematk.pl Normal file
View File

@@ -0,0 +1,90 @@
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::Scale;
my $mw = Tk::MainWindow->new(-title=> "EMA Logs von Duplikaten bereinigen");
my $answer = "";
my $button1 = $mw->Button(
-text => "Datei öffnen",
-command => \&show_file_dialog,
)->pack(-side => 'left',);
my $label = $mw->Label(
-text => 'Zu verarbeitende Datei auswählen.',
)->pack(-side => 'left',);
my $button2 = $mw->Button(
-text => "Start",
-command => \&convert,
)->pack(-side => 'right',);
$mw->MainLoop();
sub show_file_dialog {
my @ext = (
["Text Files", [qw/.csv .txt/]],
["All files", [qw/*/]],
);
$answer = $mw->getOpenFile(
-filetypes => \@ext,
);
my $out;
$out=$answer;
$out =~ s/(.*)\.([a-z0-9]*)$/$1\.conv\.$2/;
my $txt = "Verarbeite $answer nach $out";
$txt =~ s/\//\\/g;
$label->configure(-text => "$txt");
}
sub convert {
my $file=$answer;
return if ($file eq "");
my $out = $file;
$out =~ s/(.*)\.([a-z0-9]*)$/$1\.conv\.$2/;
open IN, "<$file";
my @INA=<IN>;
my $count=@INA;
close IN;
open OUT, ">$out";
my $liner = 0;
my $linew = 0;
my @uniques;
my $found;
my $text;
foreach (@INA) {
chomp;
$liner++;
$text = sprintf "[%d/%d] %05.2f%%, %d geschrieben", $liner, $count, $liner/$count*100, $linew;
$label->configure(-text => "$text");
$mw->update if ($liner%10);
my ($id,$account,$direction,$doctype,$subtype,$size,$from,$to,$cc,$subject,$senttime,$receivedtime,$archivetime,$messageid) = split /;/,$_;
my $unique = $senttime . $messageid;
my $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++;
}
my $c=@uniques;
shift @uniques if ($c>100);
}
$text = sprintf "[%d/%d] %05.2f%%, %d geschrieben", $liner, $count, $liner/$count*100, $linew;
$label->configure(-text => "$text");
$mw->update;
close OUT;
}