global_file_changes

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: replace file entries or something.
From: "Steve \"Stevers!\" Coile" <scoile@redhat.com>
Date: Thu, 1 Jul 1999 08:43:00 -0400 (EDT)


On Thu, 1 Jul 1999, Piotr Niezurawski wrote:
> awk '{gsub("old@aaa.oo", "new@bbb.pp"); print}' *.html

This would not save the changes.

Better:

	for f in *.html
	do
		cp "$f" "$f.old"
		sed -e 's/\<old@aaa.oo\>/new@bbb.pp/g' "$f.old" > "$f"
	done

===

((There's a Perl one-liner that seems clearly superior to this method.

    perl -p -i.old -e "s/\<old@aaa.oo\>/new@bbb.pp/g;" *.html

See p.332 of the blue camel, the 2nd ed of "Programming Perl" by Larry Wall,
Tom Christiansen & Randal L. Schwartz, from O'Reilly &
Associates.

        --- Joe B. 
))

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu