sed,用linux:http:// cdn1replace为https:// cdn1

我想用https://cdn1.domain.comreplace200.html文件中的http://cdn1.domain.com ,我不知道如何用sed来做。

有人可以帮我吗?

 sed -i '/http:/\/\cdn1/http:/\/\cdn1/' cum-comand.html sed: -e expression #1, char 8: unknown command: `\' sed -i '/http:\/\/cdn1/http:\/\/cdn1/' cum-comand.html sed: -e expression #1, char 17: extra characters after command 

如果他们在同一个目录下,你可以这样做:

 sed -i 's|http://cdn1.domain.com|https://cdn1.domain.com|g' *.html 

如果没有,运行find:

 find . -name "*.html" -exec sed -i 's|http://cdn1.domain.com|https://cdn1.domain.com|g' {} \;