Replacing text for all files in a directory

Mats Wichmann xyzmats at laplaza.org
Wed Aug 8 14:21:34 EDT 2001


On 08 Aug 2001 09:18:10 +0200, Harald Kirsch
<kirschh at lionbioscience.com> wrote:


:Everyone, (even me) seems to be sure that this calls for something
:sh/sed/awk like. Nevertheless, I'll try a Python one.

I disagree.  sed is unabashedly line-based.  Making it replace
patterns that happen to break across a line is more work than it's
worth, in my opinion.

Don't forget the fileinput module for cases like this.



Mats Wichmann

(Anti-spam stuff: to reply remove the "xyz" from the
address xyzmats at laplaza.org. Not that it helps much...)



More information about the Python-list mailing list