我想搜索为string
和另一个string
取代它递归一个目录下。 例如: 我想搜索字符串如何搜索一个字符串,并用linux中的其他字符串替换它?
"var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");"
和与
var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-7044592-1']);_gaq.push(['_setDomainName', 'news4u.com']);_gaq.push(['_trackPageview']);
更换它是如何实现的呢?
我试过下面这段代码(我正在用'goo'来代替测试) 'find/home/project/new4u/apps/frontend/modules/alerts/templates/testing -type f -exec sed - 我的/ var gaJsHost =((\“https:\”== document.location.protocol)\?\“https:\/\/ssl。\”:\“http:\/\/www。\” )/ goo /“{} \;' 它工作不正常。我已经逃过了所有的分隔符,但仍然不起作用。请让我知道要做些什么改变。 – 2012-07-09 09:19:06
你已经逃脱了太多,'?'不是BRE元字符。另外,如果你使用'''引号,那么你不需要转义'''字符,如果你使用#从#到#而不是's/from/to /',那么你不需要需要跳过'/'字符 – 2012-07-09 09:48:11
非常感谢,我停止了逃避?“并且它工作。 – 2012-07-09 11:19:23