0

I want to replace the specific string memory_limit = 128M with memory_limit = 512M in the file /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?

kos
  • 35,891
showkey
  • 342

2 Answers2

3

Just use sed -i to change the file in place.

schlady
  • 46
0

You can use Vim in Ex mode:

ex -sc '/memory_limit = /s/128/512/|x' /etc/php5/apache2/php.ini
  1. /memory_limit = / find correct line

  2. s substitute

  3. x save and close

Zombo
  • 1