How to quickly remove a configuration from a whole bunch of files using the Linux utility SED

Every now and again, dread, you have a number of configuration files that have an incorrect value. Recently we encountered this problem on an Apache server. It seems CGI PHP execution mode wasn’t present and we need to remove the flag php_admin_value en mass. The command to achieve this is below and can be easily adapted for other strings and files:

sed -i "/\b(php_admin_value)\b/d" /etc/apache2/sites-available/*

Happy hunting.

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top