Spent a few hours today trying to get this to work, and so far no luck. I'm trying to write a simple sed script for removing sections of ini-like files. In reality, I need it to remove modules from rsyncd.conf file. Here's some sample content:

Code:
# Global options
address  = localhost
pid file = /var/run/rsyncd.pid

# Module defaults
use chroot      = true
max connections = 100

[module1]
path = /home/rsync/module1

[module2]
path = /home/rsync/module2
log  = /home/rsync/module2/log

[module3]
path = /home/rsync/module3
I need a script that will delete modules given their names. So given 'module2' as input, the above file would be transformed to this:

Code:
# Global options
address  = localhost
pid file = /var/run/rsyncd.pid

# Module defaults
use chroot      = true
max connections = 100

[module1]
path = /home/rsync/module1

[module3]
path = /home/rsync/module3
Basically, remove every line starting with the module name and up to the first empty line or end of file. Can anyone at least point me in the right direction for how to do this?

Thanks!