我想搜索爲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