[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash script question



On Mon, 2003-05-05 at 16:29, Rudy Gevaert wrote:
> Hallo,
> 
> I have a directory with files, and in every file I want to replace:
> templates/images
> with
> http://users.pandora.be/webworm/images
> 
> How can I do this in an easy way?

cd directory
for f in `find . -type f`
do
   sed -e 's|templates/images|http://users.pandora.be/webworm/images|g' $f >$$
   cat $$ >$f    # do it this way to preserve existing ownership and perms
done
rm $$

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Do not repay anyone evil for evil. Be careful to do
      what is right in the eyes of all men."     
                            Romans 12:17 



Reply to: