[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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@blackfoot ~]$ cat parse.awk
/<VirtualHost / { save = "" }
/ServerName/    { host = $2 }

{ save = sprintf("%s%s\n", save, $0); }

/<\/VirtualHost>/ { print save > "tmp/"host".conf"; }


[gneill@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