![]() |
|< 1 2 3 4 5 6 >| | ![]() |
52 entries, 6 pages |
1
2
3
4
5
6
7
8
9
$line= substr($_,10,length($_));
@array = split(/ /, $line);
$line='';
foreach my $idx (0 .. 5) {
$array[$idx].="|"
}
print "$counter|",@array,"\n";
1 2 3 4
my $string = "Dies ist ein Test"; my @array = split / /, $string; my $new_string = join "|", @array; print $new_string;
$string =~ tr/ /|/
1 2 3 4 5 6 7 8 9
if( $line =~ /^Context/ ){ $line =~ s/^Context:\s+//; my @array = split /\s/, $line; if( $array and $array[2] ne '' ){ # mach was wenn $array[2] nicht leer ist... } $line = join "|", @array; print $context $line; }
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use strict;
use warnings;
use Time::HiRes qw(gettimeofday);
my @logfilelist =glob("*.log");
my @datfilelist = glob("*.dat");
#my $file = '/dntrading-webapp_snorfu2_2007-05-24_05-43-11_1.log.20070526_050348.log';
my $context_file = "frontend_context.dat";
my $message_file = "frontend_message.dat";
my @array;
my $counter=0;
my $MessageFound=0;
my $line;
my $tmp_line;
my $t0 = gettimeofday();
foreach my $datFile(@datfilelist) {
unlink($datFile);
print "$datFile gelöscht \n";
}
open my $context, '>>', $context_file or die $!;
print $context "CONTEXT_ID|CONTEXT_DATE|CONTEXT_TIME|SESSION_ID|LID-USER|LID-KUNDE|ORDERCHANNEL|SOURCE\n";
open my $message, '>>', $message_file or die $!;
print $message "MESSAGE_ID|MESSAGE\n";
foreach my $logFile(@logfilelist) {
open my $in , '<', $logFile or die $!;
print "Umstrukturieren $logFile \n";
while( my $line = <$in> ){
if( $line =~ /^Context/ ){
$line=~ s/^Context:\s+//;
@array = split /\s/, $line;
$line = join "|", @array;
if( $array[2] ne '' ){
$counter++;
print $context "$counter|$line\n";
}
}
if( $line =~ /^Message:/ || $MessageFound){
if($array[2] ne '')
{
$MessageFound=1;
if($line =~ /^\n/)
{
chomp($line);
$line =~ s/\s/ /g;
print $message "$counter|$tmp_line\n";
$tmp_line = '';
$MessageFound=0;
}
else
{ chomp($line);
$line=~ s/\s/ /g;
$tmp_line .= $line;
}
}
}
}
close $in;
}
close $message;
close $context;
1 2 3
if( $array and $array[2] ne '' ){ # mach was wenn $array[2] nicht leer ist... }
![]() |
|< 1 2 3 4 5 6 >| | ![]() |
52 entries, 6 pages |