SED

am Ende des Dokuments

'$a …​'

sed -i '$a<Directory "/var/www/html">\n AllowOverride All \n</Directory>' /etc/apache2/apache2.conf

Replace

Match ersetzen

sed -i 's/AllowOverride All/AllowOverride None/g' test.txt

Zeile nach einem Match

Vorher

#test.txt
<Directory "/var/www/html">
 AllowOverride None
</Directory>
<Directory "/var/www">
AllowOverride None
</Directory>
---

[source, shell]

sed -i '/<Directory "\/var\/www">/!b;n;cAllowOverride All' test.txt

Danach:
[source, test.txt]

#test.txt <Directory "/var/www/html"> AllowOverride None </Directory> <Directory "/var/www"> AllowOverride All </Directory> ---