May2

【原创】如何在linux上快速查找同编码类型文件

Author: leeon  Click: 3135   Date: 2017.05.02 @ 13:54:47 pm Category: linux

网上的说法都是通过vim,或者enca命令来确认编码,但是vim效率太低,不能他批量执行。enca又因为编码格式的支持不是太好使,有可能会提示

enca: Cannot determine (or understand) your language preferences.

Please use `-L language', or `-L none' if your language is not supported

(only a few multibyte encodings can be recognized then).

Run `enca --list languages' to get a list of supported languages.


其实我们常用的file命令带有编码探测功能。只要我们后面加上一个--mime-encoding就可以准确探测文件编码类型了。
例如:
file --mime-encoding a.html

如果我们要批量查找htm结尾的utf8编码的文件:
 find . -type f -name '*.htm' | xargs -n1 file --mime-encoding | grep 'utf-8'



TAG:   编码 uf8 linux

    评论
    • 提交

    分类

    标签

    归档

    最新评论

    Abyss在00:04:28评论了
    Linux中ramdisk,tmpfs,ramfs的介绍与性能测试
    shallwe99在10:21:17评论了
    【原创】如何在微信小程序开发中正确的使用vant ui组件
    默一在09:04:53评论了
    Berkeley DB 由浅入深【转自架构师杨建】
    Memory在14:09:22评论了
    【原创】最佳PHP框架选择(phalcon,yaf,laravel,thinkphp,yii)
    leo在17:57:04评论了
    shell中使用while循环ssh的注意事项

    我看过的书

    链接

    其他

    访问本站种子 本站平均热度:8823 c° 本站链接数:1 个 本站标签数:464 个 本站被评论次数:94 次