I am planning to replace certain strings in a file; so I am using sed.
I would like to have the string replaced, while instead, sed read the string and append the text in the middle of the string.
Example:
string in myfile : user=blabla
string that I want to obtain: user=bob
so I run sed in this way, to have it to search for the "user=" string, and replace it with "user=bob"
sed -i 's/user=*/user=bob/' myfile
What I get is
user=bobblabla
Basically sed think that I want to replace just that part, while I want to replace the whole string with the new string. I thought that the * would tell sed to consider anything coming after, but it does not work.
Since I do not know what the "blabla" will be, I can't put it in the sed command. How do I tell sed to find a string that start with "user=" and replace the whole string with the new one?