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

hlubenow
 2015-08-07 17:32
#181740 #181740
User since
2009-02-22
875 Artikel
BenutzerIn
[default_avatar]
Du wolltest ja nur die Zeilen mit "false" haben, daher dachte ich eher an sowas:
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
#!/usr/bin/perl

use warnings;
use strict;
my @a = <DATA>;
my @b = grep(/false/, @a);
chomp(@b);
for (my $i=0; $i <= $#b; $i++) {
    print $i + 1;
    print ". ";
    print "$b[$i]\n";
}


__DATA__
            2015.07.23  16:47:23
                          false,    false,       true,      false,    true,    false,
                  defau,  ame_a,    ame_m,       ame_uc,     ame_f,    ams_l,  en_affi,
            true  DPA01,  fault,    fault,       fault,      fault,    fault,      1,
            false DPA02,       ,         ,            ,           ,    fault,      1,
            true  DPA03,  fault,    fault,         olt,      fault,    fault,      1,
            false DPA01,  fault,       at,       fault,          2,    fault,      1,
            false DPA02,       ,         ,            ,           ,    fault,      1,
            true  DPA03,  fault,    fault,         olt,      fault,    fault,      1,

View full thread File sortieren