Created
October 15, 2025 09:29
-
-
Save eugrus/6bab21149068fe7bd33dd0d29bf18299 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param ( | |
| [string]$FilePath, | |
| [Parameter(ValueFromRemainingArguments = $true)] | |
| [string[]]$Patterns | |
| ) | |
| if (-not (Test-Path $FilePath)) { | |
| Write-Error "'$FilePath' not found." | |
| exit 1 | |
| } | |
| $content = Get-Content $FilePath -Raw | |
| foreach ($pattern in $Patterns) { | |
| $content = $content -replace $pattern, "" | |
| } | |
| Set-Content $FilePath $content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment