Just-Blog, 就是Blog

如何在 Linux 搜尋目錄下包含某字串的檔案,並將字串替換為其他字串?

by 連小峰 on 六月.21, 2007, under 電腦三兩事

這也是一個常常用到的功能….方法如下:

find ./ -type f -exec sed -i ‘s/string1/string2/’ {} \;

string1 是要找的字串,string2 是要替換成的字串。


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...