sed search and replace with variable containing slash
Use something other than /
as the delimiter for the regex (for example, the colon :
):
sed -i "s:search text /TAG/:replace text ${variable}:" "${textfile}"
Or escape the /
in the variable.