0

Hi -

Please help me with the following. I have to a parse a log file and here is the part of the log file which is occurs repetitively.

[Text1] [Text2] [Text3] [Text4] [Text5] [Text6] [Text7] [

===== PATTERN1 =======

Text8_line1: value1

Text8_line2: value2

Text8_line3: value3

Text8_line4: value4

.

.

.

Text8_linen: valuen

===== PATTERN1 =======

]

So basically I want to copy the text (i.e. Text1,Text2, ...... Text8) into different array or scalar variable for further processing. The brackets ([ and ]) for Text 8 are in different lines.

Please help me with this.

Thanks.

-Navsaug

4
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by katharnakh
0

I'm not sure if I understand exactely what you need to do...But This may help.

open(LOG, "path/to/logfile.log")|| die "Error: $!";
 
my @text; 

while(<LOG>){
if(/(\[.*\])/g){
push(@text, $1);
}
}
close(LOG);
0

This guy posted on a number of forums and already has a solution, he will not be coming back here to read your response.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.