Return to Snippet

Revision: 46850
at May 26, 2011 18:57 by elm


Initial Code
// copy with substitution

new File('new.txt').withWriter { file ->
    new File('orig.txt').eachLine { line ->
        file.writeLine( line.replace('code', 'joy') )
    }
}

Initial URL

                                

Initial Description
Write File while replacing from anothther

Initial Title
Groovy - File copy with substitution

Initial Tags
groovy

Initial Language
Groovy