How to make a recursive replacement in a file?

Let's say I want to scan every file in this directory (also recursive).

And I want to replace happy.magic with sad.apps.magic

How can i do this?

+4
source share
2 answers
 find . -type f -exec sed -i 's,happy.magic,sad.apps.magic,g' {} \; 
+5
source

Eric is right, but just to be clear:

 find ./ -type f -exec sed -i "s/happy\.magic/sad\.apps\.magic/g" {} \; 
0
source

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


All Articles