Do you know where your variables are? | |
PerlMonks |
Re^2: Parsing log file with regular-expression match nested bracketsby thanos1983 (Parson) |
on Feb 28, 2017 at 16:20 UTC ( [id://1183159]=note: print w/replies, xml ) | Need Help?? |
Hello 1nickt, Well my first step is to read the log file into a string as I am doing. Then as a second step is to split complete entities from log file into separate array elements that start with ([ 11] 25/2/2017-19:02:06.980 proces_name thanos-Rx: UDT{) and end with (}). As a third step I want them to spit each array element into separate lines based on new line characters (\n) into separate element on sub array. The reason that I want to do that is to have concrete element reference so when I will be using loops with regular expressions rules to search through the array elements it will match. My ultimate goal is to match entities "first level array elements" with each other based on similarities with in the lines. It sounds a bit of complicated so I will try to simplify it. Let say that I have a log file:
For simplicity reasons I kept the sample of log file without any complexities. So lets assume that: [ 11] 25/2/2017-19:02:06.980 proces_name thanos-Rx: line7: data contains some data that I want to fine exactly the same match on the log file e.g.: [ 11] 25/2/2017-19:02:06.980 proces_name thanos-Tx: line11: data .it would be very simple if we wanted to catch the single line but I need to return the whole array containing all the lines that starts [ 11] 25/2/2017-19:02:06.980 proces_name thanos-Rx: UDT{ and ends with }. So the expected and desired result would be a hash:
I hope my explanation did not confused more it helped you to understand my approach to my problem. If you have any further questions please do not hesitate to ask.
Seeking for Perl wisdom...on the process of learning...not there...yet!
In Section
Seekers of Perl Wisdom
|
|