I'm trying to search and replace every occurrence of
<a href="#" data-role="button" data-inline="true" data-rel="back">Cancel</a>
with:
<a data-role="button" data-inline="true" onclick="$(this).closest('[data-role=popup]').popup('close');">Cancel</a>
So I use sed for this purpose, the problem is that in my search and replace string it contains / and " which I don't know if I should escape them or not so I don't get errors. Any suggestions?
find . -type f -print0 | xargs -0 sed -i 's/<a href="#" data-role="button" data-inline="true" data-rel="back">Cancel</a>/<a data-role="button" data-inline="true" onclick="$(this).closest('[data-role=popup]').popup('close');">Cancel</a>/g'