deleting multiple virtualhosts from httpd.conf

I am running apache-1.3.22-5.7.1 on RH7.2, over the years i have accumulated hundreds of Virtual Host block in my httpd.conf and the domains are no more hosted with us. I want to remove the virtaull host blocks to clean up the httpd.conf, doing this manually would take long as there are hundreds of virtual hosts. I am sure there must be some script shell/cgi/php which can accomplish this task.

Also, most importantly i host mutiple domains in one folder, so is there any way the script would take the document root from me, say "/home/web/viv" and delete all the virtual hosts blocks which are hosted with document root /home/web/viv, for eg. /home/web/viv/domain1.com, /home/web/viv/domain2.com and so on?

I would not mind specifying each domain name one-by-oen, it's just that it would take a lot of time to delete hundreds of names whereas specifying a document root and deleting all subsequent domains hosted inside it would be that much faster. I would prefer a script which could run from shell.

FYI my virtual host block is 9lines, i.e. from <virtualhost> to </virtualhost> it is 9 lines in total if that helps.

All you hosting wizards pls jump in to help deleting multiple virtualhosts from httpd.conf

 

 

 

 

Top