使用注意项:

原来文件格式gbk的,否则可能出现utf-8转utf-8乱码。

#!/bin/bash
function gbk2utf(){
file="$1"
echo "处理文件 '$file' ..."
iconv -f gb2312 -t UTF- -c "$file" > tmp
mv -f tmp "$file"
} function getdir(){
for element in `ls $`
do
dir_or_file=$"/"$element
echo $dir_or_file
if [ -d $dir_or_file ]
then
getdir $dir_or_file
else
gbk2utf $dir_or_file
fi
done
}
getdir $
运行:sh gbk2utf.sh dir

转自:https://blog.csdn.net/pangyemeng/article/details/74315869

最新文章

  1. .net基本数据类型操作
  2. USE “schema_name” in PostgreSQL
  3. 关于js的string的3个函数slice,substring,substr对比
  4. 微信开发学习日记(八):7步看懂weiphp插件机制,核心目标是响应微信请求
  5. HDU 1244 Max Sum Plus Plus Plus
  6. live 写博
  7. 服务器RAID配置全程与RAID基础知识
  8. 浅谈window.attachEvent
  9. storm第一篇--概念,例子,参数优化
  10. bzoj2876 [Noi2012]骑行川藏
  11. HDFS Architecture
  12. mstsc远程连接发生身份验证错误要求的函数不受支持
  13. centos7安装配置jdk
  14. logistic回归具体解释(二):损失函数(cost function)具体解释
  15. MySQL参数化查询的IN 和 LIKE
  16. 标签传播算法(Label Propagation)及Python实现
  17. c# 判断当前时间是否在某一时间段内
  18. 深入理解python中的yield关键字
  19. Final发布中间产物
  20. Java开发23种设计模式

热门文章

  1. linux 非root用户安装nginx
  2. Linux 反弹shell(二)反弹shell的本质
  3. Navicat连接MySQL数据库出现 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded
  4. 深度学习环境搭建(CUDA9.0 + cudnn-9.0-linux-x64-v7 + tensorflow_gpu-1.8.0 + keras)
  5. 【转】MarkDown添加图片的三种方式
  6. redis的生产环境中的部署?
  7. Redis中如何保证数据库和缓存双写时的数据的一致性?
  8. Office2016专业增强版永久激活
  9. 【一起来烧脑】底层HTTP深入笔记
  10. 【一起来烧脑】入门ES6体系