sed experts. Help

Rick Knight rick_knight at rlknight.com
Thu Oct 23 17:04:17 UTC 2008


Glenn R Williams wrote:
> Jared,
>
> sed -i '/^<?php eval(base64_decode(.*/d' *.php
>   
can I add .bak to this command to have it backup the files?
> will update all files in place, deleteing all lines beginning with:
>
> <?php eval(base64_decode(
>   
This should have been <?php /**/eval(base64_decode (my mistake). How 
would I add /**/ to this command?
> 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
>>>       
>
>   

Thanks,
Rick




More information about the kubuntu-users mailing list