8 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
my $file = 'path/to/log.dat';
my $out = 'path/to/outfile.txt';
open(READ_LOG,"<$file") or die $!;
my @lines = <READ_LOG>;
close READ_LOG;
chomp(@lines);
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;
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;
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl
use strict;
use warnings;
$/ = "\n[";
while (<>) {
next unless /is Changed to/;
chomp;
s/\s*\n\s*/; /g;
s/^\[?/[/;
print $_, "\n";
}
8 Einträge, 1 Seite |