I am trying to remove all the lines from a text file that contains a partial string using the below PowerShell code:
Get-Content C:\\new\\temp_*.txt | Selec
The pipe character | has a special meaning in regular expressions. a|b means "match either a or b". If you want to match a literal | character, you need to escape it:
|
a|b
a
b
... | Select-String -Pattern 'H\|159' -NotMatch | ...