w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Powershell search for every instance of string and then replace entire line
$file='C:TempClientConduit.xml'
$replace='           <PROPERTY propname="jmsPassword" proptype="STRING"
propvalue="!abcd1234"/>'
(Get-Content $file) | % {
    if($_ -like "*jmsPassword*") {
        $_ -replace '^.+',$replace
    }
    else {
        $_
    }
} | set-content $file




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.