Thread Textdatei auslesen und nach bestimmten Filterkrite (7 answers)
Opened by Arasiel at 2004-08-06 11:43

renee
 2004-08-06 12:22
#85469 #85469
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
my $file = 'path/to/log.dat';
my $out = 'path/to/outfile.txt';
my @lines = ();

open(READ_LOG,"<$file") or die $!;
while(my $line = <READ_LOG>){
 chomp($line);
 push(@lines,$line) if($line !~ /^\s*?$/);
}
close READ_LOG;

my @entries = ();
for(0..$#lines){
next unless($lines[$_] =~ /\[\d{2}\/\d{2}\/\d{4}/);
push(@entries,$lines[$_].'; '.$lines[$_+1].'; '.$lines[$_+2]);
}

open(WRITE_OUT,">$out") or die $!;
for(@entries){
print WRITE_OUT $_,"\n" if(index($_,'is Changed') != -1);
}
close WRITE_OUT;
\n\n

<!--EDIT|renee|1091780564-->
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 Textdatei auslesen und nach bestimmten Filterkrite