I know that I can use the -A and -B command for grep to get a lot of what I am looking for however that is not quite what I want.
I am looking to parse the httpd.conf file to search for a domain. Then display everything between the VirtualHost tags for that domain. A example of the virtualhost is as follows.
To search for a domain I run the following command:
less /usr/local/apache2/conf/httpd.conf |grep domain.tld
But that does not give me the full virtualhost only the lines that contain the domain.
<VirtualHost 192.168.1.10:80> SSLEngine on SSLCACertificateFile /usr/share/ssl/certs/ca-bundle.crt SuexecUserGroup anzenketh wheel ServerName anzenketh.net ServerAlias www.anzenketh.net ServerAdmin firstname.lastname@example.org DocumentRoot /home/anzenketh/www/anzenketh.net ScriptAlias /cgi-bin/ "/home/anzenketh/www/cgi-bin/" <Directory /home/anzenketh/www/cgi-bin> AllowOverride None Options ExecCGI Order allow,deny Allow from all </Directory> CustomLog /var/log/httpd/anzenketh/anzenketh.net-access_log combined ErrorLog /var/log/httpd/anzenketh/anzenketh.net-error_log </VirtualHost>