[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-user
Subject:    Re: [gentoo-user] OT: global search and replace
From:       Andrew Ross <aross () westnet ! com ! au>
Date:       2004-09-09 2:33:59
Message-ID: 1094697239.8391.17.camel () localhost
[Download RAW message or body]

On Thu, 2004-09-09 at 11:42, Adam Carter wrote:
> I need to run a script over all the docs in a htdocs folder (and sub 
> folders) to do a s/oldhostname/newhostname/g - my shell-fu is not up to 
> the task. How can i acheive this?

# Do the substitution on all files in current dir and subdirs
( find . ) | while read FILE
do
	sed -i 's/oldhostname/newhostname/g' "${FILE}"
done

# Remove temp files created by sed
for TMP_FILE in $(find . -empty -name 'sed*')
do
	rm ${TMP_FILE}
done


Cheers

Andrew


--
gentoo-user@gentoo.org mailing list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic