My oratab file has following content:
cat /etc/oratab
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
+ASM1:/u01/app/12.2.0.1/grid:N
exaiaddb:/u02/app/oracle/product/12.2.0/dbhome_2:Y
nttest:/u02/app/oracle/product/12.2.0/dbhome_3:Y
Variable 1 : $DB_NAME=nttest
Variable 2: $DB_UNI_NAME=nttest_iad92
I simply want to find $DB_NAME in above file and replace with $DB_UNI_NAME
I tried the following, but it is not updating the file
sed -i 's/${DB_NAME}/${db_uni_name}/g' oratab
[bash] [sed] use shell variables. Good luck.sed -i 's/${DB_NAME}/${db_uni_name}/g' oratab... Change the single-quotes to double-quote to allow variable-expansion to take place.... Single-quotes prevent variable-expansion, so yoursedcommand is literally looking for the characters${DB_NAME}(that is'$','{','D','B', ....) in your file.