If I want to remove from document lines with some string key ("foo" for example) I use this:
$content = Get-Content 'C:/fake.txt' | Where-Object {$_ -notmatch 'foo'}
$content | Out-File 'C:/fake.txt'
But now I have file with this scheme:
...
<data name="BLABLA" xml:space="preserve">
<value>some data here</value>
</data>
...
<data name="BLABLA22" xml:space="preserve">
<value>some data</value>
<comment>some comment</comment>
</data>
And I need to remove for key "BLABLA" this three lines
<data name="BLABLA" xml:space="preserve">
<value>some data here</value>
</data>
And for key "BLABLA2" this four lines
<data name="BLABLA22" xml:space="preserve">
<value>some data</value>
<comment>some comment</comment>
</data>
How can I do this by means of powershell?