Aloha Bart, "Bart Bunting" <b...@bunting.net.au> writes: > Good morning, > > I have been trying to figure out without much luck how to use babel to > generate some cisco configs. > > > What I would like to achieve is to have a table containing a few values, > e.g. ip address vlan number etc. > > Then have a cisco config in the org file with markers where the > substitutions are to be inserted. > Run through the table and create a node in the org file one for each row > of the table. > > The end result should be a set of cisco configs with the substitutions > made. I was hoping to also use shell to call pwgen to generate a > random password to insert. > > Hope that ramble made some sort of sence.
I don't know a Cisco config from a fig newton, but here is my sense of what you wrote, in case it is helpful. #+name: cisco-table | 1 | one | two | | 2 | three | four | | 3 | five | six | #+header: :results output raw #+header: :var x=cisco-table #+begin_src python for y in x: s = "* Cisco %s \nTwiddle %s, poke %s \n\n" % tuple(y) print s, #+end_src #+results: * Cisco 1 Twiddle one, poke two * Cisco 2 Twiddle three, poke four * Cisco 3 Twiddle five, poke six -- Thomas S. Dye http://www.tsdye.com