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

[ale] char replacement - repost



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