in reply to perl one liner to search for a string, then search for a different string and append a new line
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. # <Directory "/usr/local/awstats/wwwroot"> Options None AllowOverride None Order allow,deny Allow from all </Directory>
Any idea how to get the matched text back? Thanks!# # This is to permit URL access to scripts/files in AWStats directory. # CustomLog /usr/local/awstats/logs/access_log combinedio ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: perl one liner to search for a string, then search for a different string and append a new line
by Athanasius (Archbishop) on Dec 20, 2012 at 13:37 UTC |