[geeks] changing text string in a lot of files

Dan Debertin geeks at sunhelp.org
Sun Jun 17 17:54:49 CDT 2001


On Sun, 17 Jun 2001, Bill Bradford wrote:

> I've got to edit a *lot* (4-500) RealVideo .ram files to
> replace one hostname with another - any suggestions?

mkdir new_files
for i in `ls -1 old_files`
do
	sed 's/oldstring/newstring/g' old_files/$i > new_files/$i
done

Then, rm -rf old_files and replace it with new_files.

Assumes all of your files are in the same dir; you could always use a
find if they're nested.

Dan
--
Dan Debertin
airboss at nodewarrior.org
www.nodewarrior.org





More information about the geeks mailing list