Replacing text for all files in a directory

Roman Suzi rnd at onego.ru
Tue Aug 7 22:08:25 CEST 2001


On Tue, 7 Aug 2001, <Randy.L.Kemp/at/motorola.com> wrote:

>Since I don't write Python every day, here is a simple question.
>I have a directory called test, containing files A, B, ..., Z, and I want to
>replace all occurrences of the text "Have a good day" to "jump off a cliff."
>This is a comic example, but I need to do something similar in real life.
>How can I do this in Python, running on Unix?

You can also get little utility called "rpl" and do the same with C speed,
even recursively. Or was it meant to be excersize of some kind?


Sincerely yours, Roman Suzi

P.S. Hmm... Somebody told Motorola do not use Python!
Maybe you could also clarify if Motorola is SEI CMM 5
by any chance?
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Tuesday, August 07, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "All work and no play, will make you a manager." _/





More information about the Python-list mailing list