I need to remove the following block in multiple files
resources:
limits:
memory: 300Mi
requests:
memory: 128Mi
I'm trying with the following code with no success:
Get-ChildItem '..\.\Helm-Charts\containerizedcomponents\values.yaml' -Recurse | ForEach {
(Get-Content $_) | ForEach {$_ -Replace 'resources:
limits:
memory: 300Mi
requests:
memory: 128Mi', ''} | Set-Content $_
}
How can i do this?
get-content -rawto get more than one line, but I would make backup copies first. There's also taking\rand\ninto account. Set-content also adds a newline by default.