Skip to content

Instantly share code, notes, and snippets.

@htaketani
Created July 10, 2021 15:40
Show Gist options
  • Save htaketani/a69613e42fa941c8e7f4dca2478a0f55 to your computer and use it in GitHub Desktop.
Save htaketani/a69613e42fa941c8e7f4dca2478a0f55 to your computer and use it in GitHub Desktop.
Remove UTF-8 BOM from a file (or stdin)
#!/bin/bash
# remove-utf8-bom
# Remove UTF-8 BOM from a file (or stdin)
# Usage: remove-utf8-bom [file]
# License: CC0 (https://creativecommons.org/publicdomain/zero/1.0/)
LC_ALL=C sed -e $'1s/^\xef\xbb\xbf//' -- "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment