Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

replace string in file

$
0
0

Hi, i wrote this lines:

(Get-Content $fullpath) | Foreach-Object {

      $_ -replace 'host=door1', 'HOST = exaprd-scan'`

          -replace 'service_name = prod.xyz.co.il', 'SERVICE_NAME = dwh_prd'`

           } | Set-Content $fullpath

when I run this code I get this result:

HOST = exaprd-scan

SERVICE_NAME = dwh_prd.xyz.co.il

 

I can't understand why it is not replacing the all string "service_name = prod.xyz.co.il" with 

"SERVICE_NAME = dwh_prd", why I still get the suffix "xyz.co.il"?

Thanks

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles