Tuesday, November 18, 2014

How to remove BOM from UTF-8 using sed?

How to remove BOM from UTF-8 using sed?

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//’



How to remove BOM from UTF-8 using sed?

No comments:

Post a Comment