[Tutor] Regex parsing and writing to file

Peter Mexbacher spitfire2525 at gmail.com
Tue Oct 16 18:21:11 CEST 2007


Hello,

first post here :-)

I have the following task:

1) read in a file line by line
2) parse each line with a regular expression, and substitute certain 
patterns
3) end result: the old file with the substituted stuff (and of course 
everything which did not need substitution)

My question:

Do I have to write each line out to a new file, and then rename, or can
I substitute "in place" - that the changes are incorporated in the old
file automatically?

Regards,
Peter


More information about the Tutor mailing list