How to use sed to replace text in subfolders

I use this code to replace some text in an HTML file:

sed -i 's/tttt/new-word/g' /home/zjm1126/*.html 

This is not a search for files in subfolders. How to apply this command to subfolders?

+6
source share
2 answers
 find /home/zjm1126/ -name '*.html' -print0 | xargs -0 sed -i 's/tttt/new-word/g' 
+6
source

Can you try something like

 for z in `find /home/zjm1126/ -type f -name "*.html"`; do sed -e 's/tttt/new-word/g' $z>temp; done 
0
source

Source: https://habr.com/ru/post/888204/


All Articles