Juan Pablo Feria Gomez wrote: > I want to parse a big cisco configuration on TXT and create arrays per > each configuration block...
It looks easy enough. > The script will know when each section begins/end with the "!" character There are probably a few ways you could handle that. > I'm stuck.. :( On what, in particular? > Can someone give me any pointers on the documentation? Pointers to what? > Here is a fragment of a configuration.. > > ! > dial-peer voice 3500 voip > description potx > destination-pattern 35.. > session target ipv4:1.79.15.74 > codec g729r8 bytes 50 > ip qos dscp cs3 media > ip qos dscp cs3 signaling > ! > dial-peer voice 4600 voip > description poty > destination-pattern 46.. > session target ipv4:3.25.114.190 > codec g729r8 bytes 50 > ip qos dscp cs3 media > ip qos dscp cs3 signaling > ! This may give you some ideas (UNTESTED): use warnings; use strict; my $file = 'big cisco configuration on TXT'; open my $fh, '<', $file or die "Cannot open '$file' $!"; my @data; $/ = "!\n"; # set Input Record Separator while ( <$fh> ) { next unless /codec\s+(\S+)\s+bytes\s+(\d+)/; push @data, [ $1, $2 ]; } # etc., etc. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>