Here's a log from an application and i wanted to be able to parse anything after "INFO -" till the date in next line as one varibale. You can see each line is similar till "INFO -" then the last portion is all over the place.
2012-09-14 16:55:22,498 ACTIVE ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' (com.this.perl.seems.kinda.Cool:di sconnectCORBA:154) INFO - Well this is just one line text
2012-09-14 16:55:22,498 ACTIVE ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' (com.this.perl.seems.kinda.Cool:di sconnectCORBA:154) INFO - Well this is just multiple line text
With formats Like this
***** Some other text **** then some more text on another line
2012-09-14 16:55:22,498 ACTIVE ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)' (com.this.perl.seems.kinda.Cool:di sconnectCORBA:154) INFO - Well once again this is part starts with bracket and blah blah blah
Well i tried to write this program where I was able to exactly match upto "INFO -" but the last variable matches single line and not multiple lines. I tried added \ms but that didn't help. Can we not say match everything from here on out till you match my first varible of date in next line ? Basically ask the last varible to match everything in the line till it sees next date.Any help in right direction would be much appreciated.
while ( $line = <> ) { if ($line =~ m/^(\[\d\d\d\d[-]\d\d[-]\d\d \d\d[:]\d\d[ +:]\d\d[,]\d\d\d\]) (\[\S+\]) (\S+) (\'\d\d?\d?\') (\S+ \S+) (\'.*\') +(\(.*\)) (\S+) ([ -]) (.*)/) { print $1; print $2; print $3; print $4; print $5; print $6; print $7; print "$8 "; print "$9 "; print "$10 \n"; } }
In reply to Can't seem to match from one varibale to next one. by Ben328
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |