I am trying to write a script that configures a config file used by a nother script. I am trying to use sed like this
sed -c -i "s/\($TARGET_KEY *= *\).*/\1$REPLACEMENT_VALUE/" $CONFIG_FILE
But it’s not working as it is intended to it strips the quotation marks and i cant figure out how to write it so it dont.
the second problem is that when i run this on Mac OS the out put is an error:
sed: illegal option -- c
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
I am new to usage of sed so please forgive my lack of skills in this area.
see the test below, I didn’t add “-i”, just print the output. you can add -i if you need: