linux中如何批量删除utf8 bom

这篇文章给大家分享的是有关linux中如何批量删除utf8 bom的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

低版本的gcc编译包含bom的文件会报错

xxx.cpp:1: error: stray ‘\357' in program
xxx.cpp:1: error: stray ‘\273' in program
xxx.cpp:1: error: stray ‘\277' in program

批量删除之

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

在文件末尾增加空白行

find . -name "*.h" | xargs sed --in-place -e '${G}'

感谢各位的阅读!关于“linux中如何批量删除utf8 bom”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!