-
Notifications
You must be signed in to change notification settings - Fork 0
/
logtidy.pm
50 lines (38 loc) · 928 Bytes
/
logtidy.pm
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
#!/usr/bin/perl
use warnings;
use strict;
package LogTidy;
sub tidy()
{
my @arr = FileManager->new()->readFile( Logger->new->{ _windLogFilePath } );
my @skipArray;
my $lineDiff=0;
my $lineNum=0;
my $i=0;
my $outputStr = "";
foreach my $line ( @arr )
{
if($line =~ m/\@windriver.com|of an applicable Wind River license agreement./i)
{
push(@skipArray, $lineNum-1);
push(@skipArray, $lineNum);
$lineDiff+=2;
}
$lineNum++;
}
my $arrSize=@arr;
for ($i=0;$i<$arrSize;$i++)
{
if($i ~~ @skipArray)
{
next;
}
else
{
$outputStr .= "$arr[$i]\n";
}
}
my $writeLocation = Logger->new->{ _windLogFilePath } =~ s/\.log$/_tidied\.log/r;
FileManager->new()->writeFile( $writeLocation , $outputStr );
}
1;