Bash Var Search And Replace Link to heading
Bash has a builtin mechanism for removing/replacing strings.
${variable//search/replace}
# replace 123 with 456 on string
var="string123"
echo ${var//123/456}
Another typical approach would be to use sed
echo "string123" | sed 's/123/456/'