我正在尝试删除此字符串
;document.write('<iframe src="http://google.com" scrolling="auto" frameborder="no" align="center" height="11" width="11"></iframe>');跨目录(包括子目录)中的所有文件。
我知道我必须转义字符或使用正则表达式。然而,我对正则表达式很不满意。任何有见地的人都很欣赏。
发布于 2012-12-07 02:16:39
如果要删除固定字符串,则不需要使用正则表达式。您可以将其按原样放在sed命令中,但请选择字符串中任何字符以外的分隔符(我这里使用# ):
str=";document.write('<iframe src="'"http://google.com" scrolling="auto" frameborder="no" align="center" height="11" width="11"></iframe>'"');"
find . -type f -exec sed -i.bk -e "s#$str##g" {} \;https://stackoverflow.com/questions/13749874
复制相似问题