1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
use warnings;
use strict;
my @data;
open(FH,"<BLUBBER.txt") or die $!;
while(my $line = <FH>) {
chomp $line;
my @array = (split(/;/,$line));
$array[-1] =~ tr/0xa0 //;
$array[-1] /= 1024;
if ($line =~/\bBLUBB|SAND?\b/ and $line !~/\bMUSCHEL\b/){
push(@data,[@array]);
} # if
} # while
close (FH);
my $format = '';
for my $i(0..scalar(@{$data[0]})-1){
my $max = find_longest(map{$_->[$i]}@data);
$format .= '%-'.$max.'s ';
}
for my $entry(@data){
print sprintf($format . " ",@$entry);
}
open(OUTDATEN,">ZIEL.txt") or die $!;
for my $entry(@data){
print OUTDATEN join(';',@$entry),"50"," ";
}
close (OUTDATEN) or die $!;
sub find_longest{
my $longest = 0;
for(@_){
my $length = length($_);
$longest = $length if($length > $longest);
}
return $longest;
}