开发者

Change all with command line

开发者 https://www.devze.com 2023-01-06 13:44 出处:网络
I\'m wondering if there is a way to change a specific wo开发者_如何学Crd in all of the files within the /www/ directory using command line. Just looking for a faster way to change out a specific word

I'm wondering if there is a way to change a specific wo开发者_如何学Crd in all of the files within the /www/ directory using command line. Just looking for a faster way to change out a specific word so I don't need to open all the files manually! Thanks!


find /www -type f -exec sed -i 's/foo/bar/g' \{\} \;

This line will replace foo with bar every time foo occurs in any file in /www. Be very sure you know what's under /www and what the replacement would do to those files before running it.


You might be looking for a grep-sed solution to find and replace, if you are on a Mac (and referring to the Mac's Terminal app).

0

精彩评论

暂无评论...
验证码 换一张
取 消