symgryph has asked for the wisdom of the Perl Monks concerning the following question:

I have a firewall that has the follwoing type of dataset:

config firewall policy edit 1 set srcintf "internal" set dstintf "wan1" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ANY" set nat enable next edit 2 set srcintf "internal" set dstintf "VPN-AU" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ANY" next edit 3 set srcintf "VPN-AU" set dstintf "internal" set srcaddr "all" set dstaddr "all" set action accept set schedule "always" set service "ANY" next end

I would like to pull out information and assign to variables (or a datastructure) and print the whole thing out in CSV. I don't need most of it just how to set multipline to use config as beginning, and 'end' as the end. I then want to use perl memory to slurp up the relevant info. So I would like to see:

Policy,srcif, 2,internal
Etc. once I am done. I know how to write the regexen, just not to do multiline. Even better would be a decent data structure to store all of the mess. But I am CS illiterate and not too good at data structures. Hence this post.
"Two Wheels good, Four wheels bad."

Replies are listed 'Best First'.
Re: Using Multiline regexes to parse out paramaters
by Anonymous Monk on Nov 13, 2014 at 23:02 UTC
Re: Using Multiline regexes to parse out paramaters
by Laurent_R (Canon) on Nov 14, 2014 at 07:41 UTC
    Show us what you have. It is usually easier to correct or improve existing code than start from scratch. Also, if we see the code you've written, we are much more likely to fit your needs.