I'm trying to replace a specific "AllowOverride None" to "AllowOverride All" in the httpd.conf file.
Given the file has multiple line with the same pattern I thought I would do a multiline pattern to replace it... Unless sed has a way to choose when it should replace the pattern.
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
to:
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
I was replacing single lines with:
sudo sed -i 's|DocumentRoot "/var/www/html"|DocumentRoot "/var/www/html/test"|' /etc/httpd/conf/httpd.conf
But I'm not sure how to do it if there's multiple lines
Thanks
AllowOverride NonetoAllowOverride All, can you elaborate? Also are you looking for thegflag which tells sed to replace all matches and not just the first?'s/pattern/replace/g'sudo sed -i '151s/AllowOverride None/AllowOverride All/' httpd.confworks perfectly