Skip to content

Instantly share code, notes, and snippets.

@eugrus
Created October 15, 2025 09:29
Show Gist options
  • Select an option

  • Save eugrus/6bab21149068fe7bd33dd0d29bf18299 to your computer and use it in GitHub Desktop.

Select an option

Save eugrus/6bab21149068fe7bd33dd0d29bf18299 to your computer and use it in GitHub Desktop.
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