Thread File sortieren (13 answers)
Opened by Henri at 2015-08-05 13:40

Gast Henri
 2015-08-07 00:23
#181737 #181737
so habe ich begonnen, wie findest du hlubenow? bin ich auf dem Weg?
Code (perl): (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
31
32
33
34
   #!/usr/bin/perl
    use strict;
    use warnings;
    use autodie;
    use List::Util 'any';
     
    my $input_file = 'DATA.csv';
    my (@headers, %docs);
    my $n = 0;
    my @docs;

          
    open my $fh, '>',"fh.csv";
        
    open(my $Fhresult, '<', $input_file);
    while (<$Fhresult> ) {      
     last if (/^\d+\s+\d{2}:\d{2}:\d{2}\s*$/); 
    }
    while (<$Fhresult> ) { 
     if ($. == 3) {          
       chomp;
       
       @headers = split ( /[ ,. ;:\(\)\/\*\"]+/ );  

       next; 
     }
     next unless /\S/;
     chomp;
         
    my ($file, @fields) = split /\s*,\s*|\s+/;  
    push @docs, {'file'=>$file, 'fields'=>\@fields} if any { $_ eq 'false' } @fields;
}

close($Fhresult);

Last edited: 2015-08-07 08:58:01 +0200 (CEST)

View full thread File sortieren