This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Please UseCodeTags next time. It makes it easier to read your code.
It appears that this code replaces lines of a file that contain a specific sub string. Because modifying files on the fly is very tricky it uses an intermediate temporary file to write to first, which then overwrites the original file.