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:
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.Policy,srcif, 2,internal
In reply to Using Multiline regexes to parse out paramaters by symgryph
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |