0
sed '/^;date.timezone =/!b;:a;n;//ba;i\date.timezone = Europe/London' /etc/php.ini

You can probably guess Im creating a script for setting up LAMP servers.

In the above example the text is not replaced but instead the changes are displayed on the console.

I my goal was to insert date.timezone = Europe/London the last occurence of ;date.timezone =

ZZ9
  • 2,177
  • 2
  • 27
  • 38

1 Answers1

1

Etan Reisner: You aren't using the -i flag to tell sed to modify in place.

Community
  • 1
  • 1
ZZ9
  • 2,177
  • 2
  • 27
  • 38