Perl substitution using string that contains a dollar sign on windows

后端 未结 2 1666
暗喜
暗喜 2021-01-22 12:38

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 kno

相关标签:
2条回答
  • 2021-01-22 13:07

    Use ' as regexp delimeter symbol. It will disable all variable substitution:

    perl -p -i.bak -e "s'!MYPASSWORD!'%NEWPASSWORD%'g" a.properties
    
    0 讨论(0)
  • 2021-01-22 13:15

    I presume you are getting password from user input. why not just do that in Perl without having to go through batch since you are already using Perl? Its easier. you can then use modules like Term::Inkey to mask password and stuff.

    0 讨论(0)
提交回复
热议问题