Remove multiple BOMs from a file

后端 未结 5 874
执念已碎
执念已碎 2020-12-15 10:04

I am using a Javascript file that is a concatenation of other JavaScript files.

Unfortunately, the person who concatenated these JavaScript files together did not us

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 10:12

    fetch BOM files

    grep -rIlo $’^\xEF\xBB\xBF’ ./

    remove BOM files

    grep -rIlo $’^\xEF\xBB\xBF’ . | xargs sed –in-place -e ‘s/\xef\xbb\xbf//’

    exclude .svn dir

    grep -rIlo –exclude-dir=”.svn” $’^\xEF\xBB\xBF’ . | xargs sed –in-place -e ‘s/\xef\xbb\xbf//’

    • See more at: http://www.a5go.com/how-to-remove-bom-from-utf-8-using-sed.html#

提交回复
热议问题