[Omaha.pm] Split Apache conf file into separate files

Jay Hannah jay at jays.net
Tue Mar 6 21:31:51 PST 2007


On Mar 6, 2007, at 12:51 PM, George Neill wrote:
> Here's that quick little awk script I wrote to pull virtuals from 
> apache conf, probably not the best looking script but it has worked 
> out well for me.
>
> [gneill at blackfoot ~]$ cat parse.awk
> /<VirtualHost / { save = "" }
> /ServerName/    { host = $2 }
>
> { save = sprintf("%s%s\n", save, $0); }
>
> /<\/VirtualHost>/ { print save > "tmp/"host".conf"; }
>
>
> [gneill at blackfoot ~]$ awk -f parse.awk < some_apache_conf_file

Thanks!

I think it's perfectly legit to post things like this to the list for 
the sake of comparison to Perl. :)

j




More information about the Omaha-pm mailing list