Remove UTF-8 BOM

If you’re not sure if the file contains a UTF-8 BOM, then this (assuming the GNU implementation of sed) will remove the BOM if it exists, or make no changes if it doesn’t.

sed '1s/^\xEF\xBB\xBF//' < orig.txt > new.txt

https://unix.stackexchange.com/questions/381230/how-can-i-remove-the-bom-from-a-utf-8-file