On 4 Feb 2010, at 17:12, bsd wrote: > Hello, > > I am looking for a script to delete a zone from named.conf and maybe also > from server (zone file). > > My zone file looks like that (but could have some variations). Everything > inside brackets should be deleted… and eventually the host file.
Assuming all zone statements are identically formatted (as per your examples), then the following will work: sed -e '/^zone "bar.com" {$/,/^};$/ d' -i .bak named.conf That looks for a line that is exactly "zone "..." {" and another that is exactly "};" - and then deletes those lines and everything in between. If you want to create a script to do this, you could do: #!/bin/sh zone=$1 sed -e "/^zone \"$zone\" {/,/^};$/ d" -i .bak named.conf rm $zone James _______________________________________________ bind-users mailing list bind-users@lists.isc.org https://lists.isc.org/mailman/listinfo/bind-users