Hi All,
Here i am wriiten code to to get the every groups based on this pattern > to > as each. So i want to store the each group as "> to >" push in to array as each array elements. But i could able to store the each group. it stored has single group start from "> to end >". please help me below i have givn sample text file
bThanks & Reg,
Senthil. V
Input: >RTRV-PM-ALL:ADEL-OM3500-1:ALL:1898::,0-UP,NEND,,1-DAY,02-11,,;| ADEL-OM3500-1 09-02-12 03:46:54 M 1898 COMPLD "OC192-11,OC192:CVS,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11,OC192:ESS,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11,OC192:SESS,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11,OC192:SEFSS,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11,OC192:CVL,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-12,OC192:OPRN,40,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-12,OC192:PSCW,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1"
>RTRV-PM-ALL:ADEL-OM3500-1:ALL:1898::,0-UP,NEND,,1-DAY,02-11,,;| ADEL-OM3500-1 09-02-12 03:46:56 M 1898 COMPLD "OC192-12,OC192:PSCP,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-12,OC192:PSD,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC48-3,OC48:CVS,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11-145,STS3C:CVP,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11-145,STS3C:ESP,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" "OC192-11-145,STS3C:SESP,0,COMPL,NEND,RCV,1-DAY,02-11,00-00,1" >;
my $InputFile = "sample_log_file.txt"; open (my $IN, '<', $InputFile) or die "cannot open $ea +ch_file for writing: $!"; undef $/; # undef by default if localized while ($line = <$IN>) { #$line =~ s{^(RTRV)}{\>$1}gsi; #$line =~ s{(\"\s+)(;)}{$1\>$2}gsi; if($line =~ m/^\>(.*)\>/gis) { push @all_metrics, "$1"; } } print Dumper(@all_metrics); close($IN)
In reply to Push the each group item into array by senthil_v
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |