The 'sed' utility is what you want. It can search and replace text using regular expressions
. You should be able to 'cat' the resin.conf file into sed, do the replacement, and redirect the output back to resin.conf, something like this:
cat resin.conf | sed -e 's/ABC/XYZ/' > resin.conf
where ABC is a regular expression matching what you want to find, and XYZ is what you want to replace it with. There's a sed micro-primer
in the advanced bash guide
that may help you figure out how to insert a variable name into a sed expression.