ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Mail merge or something else?



  182FF with cup packs
I've got to do a policy review of some 150 PIX and ASA firewalls.

I have a word document I have to fill in with certain details, one doc per firewall.

Now I've written myself a nice expect script that'll ssh to all of the boxes and collect the config file and dump the results I want into a text file (or files depending on what I need)

Then I take this file and grep it for the config lines I need to put into the report.

For instance, I am grepping the config file for certain terms like "mtu", "ntp server", "snmp-server", "^http .*$", "^ssh .*$". (as the sections of the document are things like "list the interface mtu's", "are ntp servers configured", "are snmp communities configured", "what are the ssh and http management settings".

Currently I am just outputing the lines of each grep command into a text file with a blank line between each search term, in the order of the word document sections.

Ideally, I would like to just create some sort of mail merge in word and fill in the document sections automatically, by pointing it at an output file.

Problem is, that every mail merge I have ever done (years and years ago) was always fairly simple, with a CSV file of just names and addresses, and I'm not entirely sure how I'd go about getting this into word.

I can vary the output from my script to whatever is needed.

I could easilly make the output file something like this:

Code:
<firewall_1>
<mtu>
interface1 mtu
interface2 mtu
interface3 mtu
</mtu>
<ntp>
ntp server 1.2.3.4
ntp server 1.2.3.5
</ntp>
<snmp>
snmp community 1
snmp community 2
</snmp>
<http_management>
http enable
http hosts etc
</http_management>
<ssh_management>
ssh enable
 ssh hosts etc
</ssh_management>
</firewall_1>

<firewall_2>
<mtu>
interface1 mtu
interface2 mtu
interface3 mtu
</mtu>
<ntp>
ntp server 1.2.3.4
ntp server 1.2.3.5
</ntp>
<snmp>
snmp community 1
snmp community 2
</snmp>
<http_management>
http enable
http hosts etc
</http_management>
<ssh_management>
 ssh enable
 ssh hosts etc
 </ssh_management>
 </firewall_2>
Would this work?

Or maybe I could pre-pend and append a " then stick a field delimiter between each section and a record delimiter after each firewall?

Any ideas?
 

KDF

  Audi TT Stronic
Why don't you just output to a CSV file and do the merge from there.. you said you had done merges from CSV's in the past ?
 
  182FF with cup packs
Don't think CSV will work particularly well.

Each "field" of each "record" can be over multiple lines.

I think I've figured it out with an XML mailmerge. We'll see. :S
 


Top