virtualhost script

can anyone help me to write a script to delete the virtualhost entry in apache vhosts.conf file:
hint: when i enter ./deletedomain test.com it should delete the test.com virtualhost entry from vhosts.conf file

Do you want to delete the text between the lines <VirtualHost test.com> and </VirtualHost> ?

sed '/<VirtualHost test.com/,/<\/VirtualHost>/d' file

if my virtual host file is like this
<VirtualHost *:80>
DocumentRoot "/var/www/htdocs/test.com"
ServerName test.com
ErrorLog "logs/error.log"
CustomLog "logs/access_log" common
</VirtualHost>
how to write a script to delete it.

~