I'm using perl on windows and am trying to do a one liner using perl to substitute a placeholder in a file using a windows variable that contains a dollar sign. Does anyone know what the correct usage is to make it work with the dollar sign. I've tried various ways and can't seem to get it to work.
For example, I have a properties file that has a token in it (!MYPASSWORD!) that I'm trying to replace like:
somevalue="!MYPASSWORD!"
I have a batch file that looks up a variable say called NEWPASSWORD that contains the password $abc12345$ and I want to use perl substitution to replace the value like the following. Note I may not always know where the $ signs are so I cant escape them. For example another password may be abc$124$563:
echo %NEWPASSWORD% <-- this would contain $abc12345$
perl -p -i.bak -e "s/!MYPASSWORD!/%NEWPASSWORD%/g" a.properties
When its done I want a.properties to be :
somevalue="$abc12345$"
Thanks in advance