문제

Trying to use dbenham's REPL.bat to find and replace a phrase which contains a bracket '('

Need to replace (local) with 192.168.1.1 from the below string inside of an XML.

  <add name="JobRepository" connectionString="Data Source=(local);Connection Timeout=180;Integrated Security=SSPI;Initial Catalog=JobRepositorydb"

Using type input.file |repl "(local)" "192.168.1.1" >output.file

Produces:

  <add name="JobRepository" connectionString="Data Source=(192.168.1.1);Connection Timeout=180;Integrated Security=SSPI;Initial Catalog=JobRepositorydb"

But I need:

  <add name="JobRepository" connectionString="Data Source=192.168.1.1;Connection Timeout=180;Integrated Security=SSPI;Initial Catalog=JobRepositorydb"
도움이 되었습니까?

해결책

type input.file |repl "(local)" "192.168.1.1" L >output.file

You need to indicate that the search string is a literal and not a regular expression.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top