# Pastebin M8hTnuS5 foo="one@two.three" foo="${foo//@/\\@}" perl -pi -e "s/target/$foo/" test.txt