OK, I'm a little closer. It is finding the correct Directory section, it is printing the CustomLog line, but the Directory section is not printed out. That is, in the httpd.conf file I have:
#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
My code is:
perl -0777 -elnp 's/<Directory "\/usr\/local\/awstats.+<\/Directory>/$1\nCustomLog \/usr\/local\/awstats\/logs\/access_log comdinedio/s' httpd.conf What I get out is:
#
# This is to permit URL access to scripts/files in AWStats directory.
#
CustomLog /usr/local/awstats/logs/access_log combinedio
?
Any idea how to get the matched text back?
Thanks!