[ale] char replacement - repost

Geoffrey esoteric at 3times25.net
Wed Nov 19 09:46:04 EST 2003


Robert Coggins wrote:
> Sorry if you get this twice.  I did not ever see my post of this 
> question from yesterday.
> 
> Hey all,
> 
> Is there a way to change a word(chars) in every file of a directory 
> recursively? Similarly to using s/John/George/g in vim?

cd TopLevelDirectoryWhereTheFilesExist

for fn in $(find . -type f -print); do

	sed 's/John/George/g' $fn > tmpfile
	mv tmpfile $fn
done

Please test it as I've not. ;)

-- 
Until later, Geoffrey	esoteric at 3times25.net

Building secure systems inspite of Microsoft



More information about the Ale mailing list