How to use the name of the file with sed in a find expression

前端 未结 2 749
夕颜
夕颜 2020-12-21 17:30

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

2条回答
  •  再見小時候
    2020-12-21 17:43

    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" {} \;
    

提交回复
热议问题