I want to replace the specific string memory_limit = 128M with memory_limit = 512M in the file /etc/php5/apache2/php.ini:
memory_limit = 128M
memory_limit = 512M
/etc/php5/apache2/php.ini
sed 's/memory_limit = 128M/memory_limit = 512M/g' /etc/php5/apache2/php.ini
Why doesn't the command work?
Just use sed -i to change the file in place.
sed -i
You can use Vim in Ex mode:
ex -sc '/memory_limit = /s/128/512/|x' /etc/php5/apache2/php.ini
/memory_limit = / find correct line
/memory_limit = /
s substitute
s
x save and close
x