<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 16 September 2014 22:09, George Carter <span dir="ltr"><<a href="mailto:georgealun@gmail.com" target="_blank">georgealun@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can include slashes in a sed find and replace, you just need to use the escape character \ first. I.E to find http:// and replace with https:// you would use sed -i 's/http:\/\//https:\/\//g' file.php<br>
<br>
You need to put a backslash before all of the following characters:<br>
$.*/[\]^<br>
<br>
Apologies if I'm stating something you already knew - I'm new to the list but figured I'd try and help out having battled with sed a fair bit.<br>
<span class="HOEnZb"><font color="#888888"></font></span></blockquote><div><br></div><div>Quoting from my 1979 Unix manual Brian W Kernigan (who is the K in awk) says 'there is nothing sacred about slashes' so you can do s?http://?https://?  In other words 'any character can be used to delimit the pieces of the s command'  It can save a lot of back slash escaping.<br></div><div><br></div><div>Tony<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">George<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On 16 Sep 2014, at 21:08, Gareth France <<a href="mailto:gareth.france@gmail.com">gareth.france@gmail.com</a>> wrote:<br>
><br>
> Not ubuntu related but I'm hoping someone may have the answer I need. Today I discovered my webspace has been hacked and several sites now contain additional code at the start of every single PHP file. Looking at my backups I can see it  has been there for a while so restoring from a very old backup could cause me issues.<br>
><br>
> Is there some way I could do a recursive find and delete on that code? It is a very long single line including slashes, hashes, exclaimation marks etc so using sed would be difficult as the examples I have seen show /thing to change/thing to change to/.<br>
><br>
> Any ideas very welcome.<br>
><br>
> --<br>
> <a href="mailto:ubuntu-uk@lists.ubuntu.com">ubuntu-uk@lists.ubuntu.com</a><br>
> <a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk</a><br>
> <a href="https://wiki.ubuntu.com/UKTeam/" target="_blank">https://wiki.ubuntu.com/UKTeam/</a><br>
<br>
--<br>
<a href="mailto:ubuntu-uk@lists.ubuntu.com">ubuntu-uk@lists.ubuntu.com</a><br>
<a href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk" target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk</a><br>
<a href="https://wiki.ubuntu.com/UKTeam/" target="_blank">https://wiki.ubuntu.com/UKTeam/</a><br>
</div></div></blockquote></div><br></div></div>