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

Re: [cobalt-users] Searching for a text string RaQ3.



Hi,
At 09:22 02-12-2001 -0800, FantasticMoms.com wrote:
>I need to find out if there is a way of searching a RaQ3 for the presence of
>a certain text string *within* any of the *.htm files on the drive?
>
>My ISP (AT&T@Home) has just changed my email address without notice, from
>@home.com to @attbi.com

This shell script uses find to recurse through the directories and locate
*.htm files.  It calls sed to do the search and replace.  You can remove
the "rm $i.bak" line if you wish to keep a backup copy of the files.

#! /bin/sh
# filename: replaceall.sh
find . -type f -name '*.htm' -print | while read i
do
        cp $i $i.bak &&
        sed 's|@home|@attbi.com|g' ${i}.bak > $i
        rm $i.bak
done

(credits: Jim Dennis)

Regards
-sm