Eshan_k has asked for the wisdom of the Perl Monks concerning the following question:
I am a seeker of perl wisdom :) Can anyone help on this ? I have following input text:
ABC> LR_PLANE_Y, LRU_SIZE: 128X128, LRU_X: 0, LRU_Y: 0, ABC> Dif: 744374271, Rng: 51464, Cnt: 4, Ret: 1 ABC> LR_FILTER_TYPE: RESTORE_WIENER ABC> Literal: 0 ABC> Literal: 11 ABC> Literal: 14 ABC> Literal: 0 ABC> Literal: 12 ABC> Literal: 3 ABC> WIENER_VFILTER_0: 5, WIENER_VFILTER_1: -19, WIENER_VFILTER_2: +30 ABC> WIENER_HFILTER_0: 5, WIENER_HFILTER_1: -20, WIENER_HFILTER_2: +9 ABC> LR_PLANE_U, LRU_SIZE: 128X128, LRU_X: 0, LRU_Y: 0, ABC> Dif: 525860863, Rng: 38897, Cnt: 0, Ret: 1 ABC> LR_FILTER_TYPE: RESTORE_WIENER ABC> Literal: 2 ABC> Literal: 6 ABC> Literal: 9 ABC> Literal: 7 ABC> WIENER_VFILTER_0: 0, WIENER_VFILTER_1: -2, WIENER_VFILTER_2: 2 +2 ABC> WIENER_HFILTER_0: 0, WIENER_HFILTER_1: 2, WIENER_HFILTER_2: 11 ABC> LR_PLANE_V, LRU_SIZE: 128X128, LRU_X: 0, LRU_Y: 0, ABC> Dif: 66698751, Rng: 59048, Cnt: 9, Ret: 1 ABC> LR_FILTER_TYPE: RESTORE_WIENER ABC> Literal: 14 ABC> Literal: 4 ABC> Literal: 3 ABC> Literal: 5 ABC> WIENER_VFILTER_0: 0, WIENER_VFILTER_1: -22, WIENER_VFILTER_2: +25 ABC> WIENER_HFILTER_0: 0, WIENER_HFILTER_1: -13, WIENER_HFILTER_2: +12
I am doing regex match and detecting this info: LR_PLANE_Y As soon as I detect this I want to print
ABC> LR_FILTER_TYPE: RESTORE_WIENER ABC> WIENER_VFILTER_0: 5, WIENER_VFILTER_1: -19, WIENER_VFILTER_2: +30 ABC> WIENER_HFILTER_0: 5, WIENER_HFILTER_1: -20, WIENER_HFILTER_2: +9
Like this for: LR_PLANE_U This is info:
ABC> LR_FILTER_TYPE: RESTORE_WIENER ABC> WIENER_VFILTER_0: 0, WIENER_VFILTER_1: -2, WIENER_VFILTER_2: 2 +2 ABC> WIENER_HFILTER_0: 0, WIENER_HFILTER_1: 2, WIENER_HFILTER_2: 11
and for :LR_PLANE_V This is info:
ABC> LR_FILTER_TYPE: RESTORE_WIENER ABC> WIENER_VFILTER_0: 0, WIENER_VFILTER_1: -22, WIENER_VFILTER_2: +25 ABC> WIENER_HFILTER_0: 0, WIENER_HFILTER_1: -13, WIENER_HFILTER_2: +12
How can I associate this next filter information, and filter type after detecting a plane? so far I am setting a flag after I detect the plane :
Currently after detecting plane it prints out filter info for all lines.How to make sure first encountered filter info belongs to previously detected plane ?
if ($line =~ /\s*AED>\sLR_PLANE_Y/i){ $y_filter_flag = 1; if ($line =~ /\s*AED>\sLR_FILTER_TYPE:\s(\w+)/i){ #Lr_params_Y +0 if ($1 eq "RESTORE_WINNER") {$y_filt +er_type="01";} } if ($line =~ /\s*WIENER_VFILTER_0:\s(-?\d+),\sWIENER_VFILTER_1:\s(-?\d ++),\sWIENER_VFILTER_2:\s(-?\d+)/i){ ##doing dome manupulation }
Currently after detecting plane it prints out filter info for all lines.How to make sure first encountered filter info belongs to previously detected plane ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print specific data based on regex search in previous line
by Athanasius (Archbishop) on May 08, 2018 at 03:38 UTC | |
by Eshan_k (Acolyte) on Jun 01, 2018 at 04:39 UTC | |
|
Re: Print specific data based on regex search in previous line
by NetWallah (Canon) on May 08, 2018 at 05:28 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |