Script that generates tmsh commands
I found the following awesome command on devcentral that creates a file named commands.sh that contains all of the tmsh commands needed to modify the 3rd octet of every VIP on the unit:
echo '!/bin/bash' > /shared/commands.sh; tmsh list ltm virtual destination | tr '\n' ' ' | sed 's/ \+/ /g;s/ltm virtual/\ntmsh modify ltm virtual/g;s/nation 10\.23\.206/nation 10.23.207/g' >> /shared/commands.sh; chmod 755 /shared/commands.sh
What I need is a much simpler version of this command that will create a file named commands.sh that contains all of the tmsh commands needed to re-create all of the nodes on an existing unit, on a brand new unit. So the result would be:
tmsh create ltm node address tmsh create ltm node address tmsh create ltm node address etc...
I know there are easier ways to do this, like copying the node portion of the existing config and pasting it into the new config, but I have my reasons for wanting to do it the above way that I won't go into. Any help is much appreciated.