The command
groovy -pi -e "(line =~ 'a').replaceAll('b')" ok.txt
fails with
Caught: java.io.IOException: unable to rename ok.txt to C:\DOCUME~1\TOMWHI~1\LOC
ALS~1\Temp\groovy_61377.tmp
whereas
groovy -pi.bak -e "(line =~ 'a').replaceAll('b')" ok.txt
works fine.
The problem is that after creating a temporary backup file using File.createTempFile() the code needs to delete it before renaming the original to the backup.
The attached patch file fixes the problem.
applied the patch.
Hi Tom! Nice Blog! and thanx for the posting