TIMEX
TIMEX

Reputation: 271924

How do I do a recursive, in-file replace?

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

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

How can I do that?

Upvotes: 4

Views: 1117

Answers (2)

I159
I159

Reputation: 31139

Eric is right, but just to be clear:

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

Upvotes: 0

Erik
Erik

Reputation: 91270

find . -type f -exec sed -i 's,happy.magic,sad.apps.magic,g' {} \;

Upvotes: 5

Related Questions