sed experts. Help

Glenn R Williams gloonie at earthlink.net
Thu Oct 23 15:24:21 UTC 2008


Jared,

sed -i '/^<?php eval(base64_decode(.*/d' *.php

will update all files in place, deleteing all lines beginning with:

<?php eval(base64_decode(

Make a backup first, since this is a very poerful command!


HTH,

Glenn


On Thursday 23 October 2008 00:54:10 Jared Greenwald wrote:
> there's nothing that says you need to do all the files in one sed
> command, right?
>
> something like this should work...
>
> find <dir> -type f -exec sed -i.bak 's/^<?php eval(base64_decode(.*.$//' {}
> \;
>
> ...Not only will it do all the line removal, it will also make backups
> (as <file>.bak) so if you screw up you will have the original files to
> revert.
>
> -Jared
>
> On Thu, Oct 23, 2008 at 12:22 AM, Rick Knight <rick_knight at rlknight.com> 
wrote:
> > Sed experts,
> >
> > I have a bunch of php scripts, over 1000, that all need to have 1 line
> > removed. The line begins with...
> >
> > <?php eval(base64_decode(
> >
> > and is at the top of each file. How would I construct a sed command to
> > remove this line from every file in a directory and it's subs?
> >
> > Thanks,
> > Rick
> >
> > --
> > kubuntu-users mailing list
> > kubuntu-users at lists.ubuntu.com
> > Modify settings or unsubscribe at:
> > https://lists.ubuntu.com/mailman/listinfo/kubuntu-users

-- 
Glenn R Williams
-------------------------
Quis custodiet ipsos custodes?
	-- Juvenal





More information about the kubuntu-users mailing list