sed experts. Help
Alexander Smirnov
alexander.v.smirnov at gmail.com
Thu Oct 23 15:40:11 UTC 2008
Derek Broughton wrote:
> Alexander Smirnov wrote:
>
>
>> Rick Knight 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
>>>
>>>
>>>
>> why sed? you can use excluding option of grep:
>> $grep - v "<?php eval(base64_decode( "
>> will match every line but not mentioned.
>>
>
> OK, and then how do you get the output into 1000 different files?
>
something like
#!/bin/sh
mkdir new_files
for a in 'ls'; do
grep - v "<?php eval(base64_decode( " $a > new_files/$a
done;
this solution doesn't change original files. This could be a benefit :)
yes, i do know about -i.ext sed option :)
More information about the kubuntu-users
mailing list