Following a panic attack, I have to remove 4 lines of text put into .htaccess files during my site, and was thinking SED could be what you want, but cannot observe how in spire of numerous attempts.

The additional line is

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://
RewriteRule .{REMOTE_ADDR}

I handled to produce the script to get rid of added htaccess files that contains individuals lines only, however for existing htaccess files by which which was appended I must edit the file and can't remove it. I am unable to just remove line by line nor use "RewriteEngine On" because the start marker, because this instruction "RewriteEngine On" may also be legitimate elsewhere within the file.

Generally individuals line is the final, however i guess in other files they may be in the centre, and so i was attempting to remove just that block - and also have a script I possibly could reuse inside a similar situation.

(Edit: my 4 line is below each other, no blank line among however the editor here appears either to show no breakline, a treadmill adding an empty line)

Any hint or tip ? Thanks.