fwbedit [-aobj,grp] [-robj,grp] [-dobj] -fdata_file.xml
fwbedit is a general purpose object tree editing tool for Firewall Builder (see fwbuilder(1)). This tool can be used in the shell scripts written for batch-processing of the Firewall Builder data files. Fwbedit can perform the following operations on the objects and the tree: add a reference to the given object to a group, remove reference to an object from a group and delete an object and all references to it from the tree. Both object and a group can be specified by their ID or by their name and a full path in the tree (see section EXAMPLES below).
fwbedit -f x.xml -a /Objects/Hosts/A,/Objects/Groups/B
Adds reference to the Host object 'A' to the group 'B'.
fwbedit -f x.xml -a id3D71A1BA,id3D151943
Adds reference to the object with ID id3D71A1BA to the group with ID id3D151943. If objects with given IDs do not exist, fwbedit prints an error message and does not make any changes in the data file.
fwbedit -f x.xml -a id3D71A1BA,/Objects/Groups/testgroup
Adds reference to the object with ID id3D71A1BA to the group
fwbedit can be used in combination with fwblookup to execute operations on many objects:
fwblookup -f x.xml -lP /Objects/Hosts | \
grep domain.com | \
while read h; do \
fwbedit -f x.xml -a $h,/Objects/Groups/domainGRP; \
done
first, this script uses fwblookup to print full path of all Host objects (option -l in combination with option -P prints full path for all children objects of /Objects/Hosts), then uses grep to filter only those hosts that have 'domain.com' in their name, then cycles through the obtained list and uses fwbedit to add them to the group 'domainGRP'.
http://sourceforge.net/tracker/?group_id=5314&atid=105314