I'm trying to replace only part of the existing variable with a new user input variable as below:
#Current Variable: gdbName=Test.MY.DOMAIN.COM <--I need to replace the "Test" (This can be any other string not just Test e.g. CDB79 etc.) part only in this variable with new user input variable. #New user input variable: read -p "Enter CDB Name : " CDBName #I tried the following line: sed -i "s/gdbName=*.MY.DOMAIN.COM/gdbName=$CDBName/" somefile.txt
but it replaces the whole variable.
Note: I am updating the variable in a file.