I try to change Apache configuration with this:
sudo awk '/<Directory \/var\/www\/>/,/AllowOverride None/{sub("None", "All",$0)}{print}' /etc/apache2/apache2.conf | sudo tee /etc/apache2/apache2.conf > /dev/null
After this /etc/apache2/apache2.conf is empty. If I change the destination file to ~/apache2.conf for example, the output is correct.
Why?