I am trying to replace a substring of a string in a file called db_config using bash.
code in db_config file is
dbname=test_1
I want to replace "test_1" to "production".
The substring can be test_1 or test1 or testing or any random string but the format will be dbname=(whatever the name)
This needs to be changed to dbname=production
I tried both these syntax. Neither worked.
sed -i -e 's/dbname=*/dbname="ihs"/g' db_config
sed -i -e 's/dbname=$/dbname="ihs"/g' db_config
I know how to parse this in python but i cant seem to find a solution in bash.
Thanks in advance!