I am attempting to write a powershell script that will delete the line containing the <PROCEDURE> in multiple text files and delete the next 2 lines after <PROCEDURE>. No matter what I try, I can only manage to delete the line containing <PROCEDURE> and not the next 2 lines.
$start = "C:\test\"
Get-ChildItem -Recurse $start -Filter "*.txt" | Foreach{
$Path = $_.FullName
$content = Get-Content $Path | Where-Object {$_ -notmatch "<PROCEDURE>"}
$content | Set-Content $Path -Force
}