0

I'm trying to write a script to update just the hostname in the tnsnames.ora file.

I'm needing the entry to work case insensitive. For example ${DBNAME} is lowercase database name and in my tnsnames.ora file it has capital and lowercase entries i.e DEV and dev, DEV1 and dev1.

Any ideas how to make this part (${DBNAME}.WORLD|${DBNAME}1.WORLD) case insensitive?

sed -re "/^(${DBNAME}.WORLD|${DBNAME}1.WORLD) =/,/^$/s/HOST = ${HOSTNAME}/HOST = ${NEW_DBIP_NAME}/" ${TNS_ADMIN}/tnsnames.ora

  • Have you tried adding the i modifier? Also, please add an example complete with input file excerpt and desired output. – simlev Jun 19 at 8:10
0

Probably something like:

sed -re "/^(${DBNAME}.WORLD|${DBNAME}1.WORLD)/I 

The I should make it case insensitive. Add in a g if you want to make it global.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.