I have this text string within a configuration file:
jdbcService.oraclePool.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracleserver.example.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=oracleserver55)))
I'd like to replace with sed the value "(HOST=oracleserver.example.com)" without sticking to the text after the = symbol. I tried to use several regexp but cannot find the working one:
# sed 's/\((HOST=.*?)\)/(HOST=newvalue)/' customer_overrides.properties
jdbcService.oraclePool.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracleserver.example.com)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=oracleserver55)))
# sed -E 's/\((HOST=.*?)\)/(HOST=newvalue)/' customer_overrides.properties | grep HOST=
jdbcService.oraclePool.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=newvalue)
# sed 's/\((HOST=.*[^)])\)/(HOST=newvalue)/' customer_overrides.properties | grep HOST=
jdbcService.oraclePool.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=newvalue)))
I am working on:
- linux RH7
- sed-4.2.2-5.el7.x86_64
Thanks for your help!