- You are replacing text with
/
which is also used as the substitution delimiter. Escape it like this:\/
- No need to put double quotes around the replacement since they are already present in the html string.
- Use double quotes around the entire sed expression, to avoid conflict with
'
-print
is the default action forfind
and can be skipped.
Try this:
find . -name "index.php" | xargs sed -i "s/'\.\$siteUrl\.'/\//g"
Or use a different delimiter for sed, like :
and remove the escape before /
:
find . -name "index.php" | xargs sed -i "s:'\.\$siteUrl\.':/:g"
Oh, and always a good idea to save a backup of edited files (-i.bak
):
find . -name "index.php" | xargs sed -i.bak "s:'\.\$siteUrl\.':/:g"