Pathologically Eclectic Rubbish Lister | |
PerlMonks |
match multi-lines from config fileby nidhi (Acolyte) |
on Aug 06, 2007 at 22:34 UTC ( [id://630914]=perlquestion: print w/replies, xml ) | Need Help?? |
nidhi has asked for the wisdom of the Perl Monks concerning the following question:
Hi all
I am trying to match a similar set of lines from a config file and store the results in a hash. My approach is : 1. Find a line starting with string "interface". 2. Search the next following line with "description abc.xyz-conf" 3. Search the next following line with "switchport trunk allowed vlan 15-17,30,35,120,130,135,140,145,150,201,202,209" 4. Store the key-value pair for each descriptio-vlans found. - Similar patterns are to be searched across the config. Can someone suggest how do I go about doing this in perl. Any help appreciated.
Back to
Seekers of Perl Wisdom
|
|