Sed
From Blue-IT.org Wiki
Save search and replace
search="$(printf "%s\n" "src=\"${SUBDIR}" | sed 's/[][\.*^$/]/\\&/g')" replace="$(printf "%s\n" "src=\"${ANOTHER_DIR}/${SUBDIR}" | sed 's/[][\.*^$/]/\\&/g')" sed "s/${search}/${replace}/g" "${DOC}"