Sed

From Blue-IT.org Wiki

Revision as of 20:27, 10 February 2012 by Apos (talk | contribs) (Save search and replace)

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}"