Trying to answer Using Bash/Perl to modify files based on each file\'s name I ended in a point in which I don\'t know how to use find
and sed
all t
I really think the issue is that your files name contains a /
that is why sed believes it start the options strings.
Replace /
by @
in you sed command would do the job.
I try that on Linux BASH and it work perfectly
find . -type f -exec sed -i -e "s@text@test plus {}@g" {} \;
find
would return pathnames (relative or absolute) depending upon the path you specify.
This would conflict with the delimiter you've specified, i.e. /
. Change the delimiter for sed
and you should be good:
find . -type f -exec sed -i "s|text|text plus {}|g" {} \;
EDIT: For removing the leading ./
from the paths, you can try:
find . -type f -exec sh -c '$f={}; f=${f/.\//}; sed -i "s|text|text plus ${f}|g" {}' \;
I'm certain that better solutions might exist ...