Max Frai
Max Frai

Reputation: 64326

Call sed in linux

I need to replace some string into another in files. I know how to do that with single file: sed -i 's/a/b/'. But what about recursive function? I think I have to use find . -name * with xargs somehow.

I need your help :)

Upvotes: 3

Views: 5374

Answers (1)

Rich Adams
Rich Adams

Reputation: 26574

You are correct, find and xargs are what you want to use. Here's an example which will find all files with the ".ext" file extension in the current folder and all subfolders ,and replace the letter a with the letter b in the files.

find . -name "*.ext" | xargs sed -i 's/a/b/g'

Upvotes: 10

Related Questions