full-stack-professional icon indicating copy to clipboard operation
full-stack-professional copied to clipboard

sed is BRE and -E flag (extended) in MacOS

Open hazartilirot opened this issue 2 years ago • 0 comments

The issue is... it won't work as shown in the lesson:

sed -i -E 's_(amigoscode/amigoscode-api:)([^"]*)_\1'123456789'_' Dockerrun.aws.json

if you want it to work with the -E flag (extended mode), place a pair of single quote between two flags.

sed -i '' -E 's_(amigoscode/amigoscode-api:)([^"]*)_\1'123456789'_' Dockerrun.aws.json

or you may not use the extended mode you therefore need to escape each braces:

sed -i s_\(hazartilirot/hazartilirot-api:\)\([^\"]*\)_\1'123456789'_' Dockerrun.aws.json

hazartilirot avatar Apr 29 '23 20:04 hazartilirot