Yes, scripts have been written for this kind of thing for years..
for i in $MDSDIR/customers/*; do mdsenv $i; mgmt_cli ... ; done
you can also use cpmiquerybin attr "" network_objects "type=... .. to pull lists of objects and do batch processing.
you can also use the mdsquerydb (edit the $MDSDIR/conf/queries.conf file) and add aliases for the queries like:
CMA "" Hostlist attr network_objects "type='host .. etc
How to use the 'cpmiquerybin' command to list objects and their attributes
mdsquerydb / cpmiquerybin [Archive] - CPUG: The Check Point User Group
Now, for the cheat of the day.. if you are managing hundreds of CMA's with global objects.. and you have many global objects.. and it takes forever to do mdsdb processing (like batch object name changes etc).. there is a dirty trick that can speed it up dramatically.. move the entire MDSDIR/conf/mdsdb (or $MDSDIR) to a linux ramdisk.
Stop the mds, create a ramdisk (there's plenty of online guides for creating linux ramdisks) mount it.. move the $MDSDIR/conf/mdsdb (or $MDSDIR) directory to it.. then symlink it. Restart the mds.. do your processing and you will find that what might normally take hours can be done in minutes.
When it's done and working.. stop the mds services, remove the sym link and move the files back.. ace fun!
This is good to test in lab..
Iain