Posted By

elm on 05/26/11


Tagged

io groovy


Versions (?)

Groovy - File copy with substitution


 / Published in: Groovy
 

Write File while replacing from anothther

  1. // copy with substitution
  2.  
  3. new File('new.txt').withWriter { file ->
  4. new File('orig.txt').eachLine { line ->
  5. file.writeLine( line.replace('code', 'joy') )
  6. }
  7. }

Report this snippet  

You need to login to post a comment.