I have a text file that has the token "%%#%" located all over the place inside of it. I am trying to write a quick-and-dirty Groovy shell script to replace all instances of "%%#%" with a dollar sign "$".
So far I have:
#!/usr/bin/env groovy
File f = new File('path/to/my/file.txt')
f.withWriter{ it << f.text.replace("%%#%", "$") }
But when I run this script, nothing happens (no exceptions and no string replacement). I wonder if any of the characters I'm searching for, or the dollar sign itself, is being interpreted as a special char by the regex engine under the hood. In any event, Where am I going awry?