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 :)
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'
精彩评论