[Solved] Contents of file 1.txt between specific word in tag of file 2 in batch/powershell [closed]


Following should get you started

$housenames = @("Dagger Alley 1"
"Steel Home"
"Iron Alley 1"
"Iron Alley 2"
"Swamp Watch"
"Salvation Street 2"
)

$xmlTemplate = @(
'<house name="" houseid="2" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="93" />'
'<house name="" houseid="4" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="68" />'
'<house name="" houseid="5" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="94" />'
'<house name="" houseid="6" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="133" />'
'<house name="" houseid="7" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="73" />'
'<house name="" houseid="8" entryx="0" entryy="0" entryz="0" rent="0" townid="0" size="101" />'
)

for ($i=0;$i -lt $housenames.Count; $i++) {    
    $xmlTemplate[$i] -replace '<house name=""', "<house name=""$($housenames[$i])"""
}

4

solved Contents of file 1.txt between specific word in tag of file 2 in batch/powershell [closed]