0

This file would be a httpd.conf:

some_config_1
some_config_2
CustomLog /app-test.log combined
ErrorLog /error-test.log
some_config_5
some_config_6
some_config_7

If I run:

sed -E "s|(CustomLog ).*|\1${LOG_PATH} combined|" httpd.conf

[...] it prints exactly what I want, but if I run with -i:

sed -iE "s|(CustomLog ).*|\1${LOG_PATH} combined|" httpd.conf

[...] I get this error:

sed: 1: "s|(CustomLog ).*|\1/app ...": \1 not defined in the RE

If I scape the parenthesis it works, but the -E is to avoid doing this for RegEx and there's a few other samples that don't work either.

In my use case, I need to update this file, so I need to use the -i option.

Note: Although not spread, -E works as -r on Linux, AFAIK.

Anybody has any idea of what is happening here?

I'm on MacOS 10.12.4.

0 Answers0