Skip to content

Instantly share code, notes, and snippets.

@JohnL4
Created May 5, 2021 18:13
Show Gist options
  • Save JohnL4/d2694a0771b98ac90ac0fed34e9ebf77 to your computer and use it in GitHub Desktop.
Save JohnL4/d2694a0771b98ac90ac0fed34e9ebf77 to your computer and use it in GitHub Desktop.
Strip null characters from a file
# From https://stackoverflow.com/a/9866769/370611
# (Obviously, make sure you're not dealing with a Unicode file.)
foreach ($f in (Get-ChildItem *.log)) {
(Get-Content $f) -replace "`0", "" | Set-Content $f
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment