使用find
命令和file
命令:
find . -type f -exec file {} \; | grep BOM
在bash shell中使用grep
命令:
grep -rlI $'^\xEF\xBB\xBF' .
排除特定扩展名的文件(可用于跳过二进制文件和大文件):
grep -rlI $'^\xEF\xBB\xBF' --exclude=*.bin --exclude=*.dat .
find . -type f -not \( -ipath '*.bin' -o -ipath '*.dat' \) -exec file {} \; | grep BOM
排除.svn
目录:
grep -rlI $'^\xEF\xBB\xBF' --exclude-dir=.svn .
find . -type f -not \( -ipath '*.svn*' \) -exec file {} \; | grep BOM