Results 1 to 1 of 1
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. ...
- 01-12-2009 #1Just Joined!
- Join Date
- Jun 2006
- Posts
- 3
Help with a small sed script
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:
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 [module2] path = /home/rsync/module2 log = /home/rsync/module2/log [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?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
Thanks!


Reply With Quote
