Thread letzte Spalte in jeder zeile ändern: die zahlen durch best. zahl teilen (57 answers)
Opened by sabrina at 2006-10-18 18:37

renee
 2006-10-20 15:03
#70977 #70977
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Also das hier
Code: (dl )
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
#!/usr/bin/perl

use strict;
use warnings;

my @files = qw(BLUBBER.txt);
my $OUTPUT = 'ZIELgesamt.txt';

open(my $write_fh, '>', $OUTPUT) or die $!;
for my $file(@files){
open(my $fh,'<',$file) or die $!;
while(my $line = <$fh>){
$line =~ tr/\xa0//d;
my @array = (split /[\t\s\\]+/, $line)[0..7];
my $x = pop @array;
if ($x =~ /\./) {
pop @array;
my $y = pop @array;
$array[-1] .= $y;
}
else {
pop @array;
pop @array;
}
$array[-1] = sprintf('%.3f', $array[-1] / 1024);
print $write_fh join(';',@array),"\n";
}
close $fh;
}
close $write_fh or die $!;


funktioniert definitiv mit solchen Daten:

BLUBBER.txt
Code: (dl )
1
2
3
4
Bernstätter Roswita BLUBB\be3fr   66 715  457 6.7.2006 15:34
Gehring Sabrina BLUBB\ge3fr 32 016 85 5.7.2006 16:45 5.7.2006 16:45
Heizmann-Bayer Dorothea BLUBB\heb3fr 12 025 194 9.5.2006 7:41 9.5.2006 7:50
Zeile-mit-KB kleiner-100 BLUBB\heb3fr 12 194 9.5.2006 7:41 9.5.2006 7:50
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread letzte Spalte in jeder zeile ändern: die zahlen durch best. zahl teilen