IT seems that 'sed' and I will never be friends...How can I find and replace a pattern within a range (within another pattern)?In words:Find: AllowOverride None within the following range and replace it with AllowOverride All...<Directory /var/www/html>some textmore textsome commentsAllowOverride Nonemore text</Directory>...Please note (if not already done): This is related to httpd.conf which contains a lot more modules all ending with </Directory>As this command is used within a yaml file, it would be aesome to achieve this with a one-liner (I am aware, that one-liners are getting ugly pretty fast...). Also: I rely on using sed (requirement, dont ask me why - pls :))
How to find & replace pattern WITHIN specific pattern using sed
text processing;sed
With GNU sed:sed -i -e '/<Directory \/var\/www\/html>/,/<\/Directory>/{s/AllowOverride None/AllowOverride All/}' filename