I am trying to Replace a String in an xml file . but using win_lineinfile module only the last occurence of it is replaced
how can i replace a String in all occurences .
One Solution i found is tro run from powershell
(Get-Content C:\Program Files\dd\config.xml).replace(‘ToReplace’,‘replaced’) | Set-Content C:\Program Files\dd\config.xml
But when i try to use the same powershell from playbook
win_shell: (Get-Content C:\Program Files\dd\config.xml).replace(‘ToReplace’,‘sss’) | Set-Content C:\Program Files\dd\config.xml
Its executing but chnages are not happening ., Any solutions please