shell脚本将gbk文件转化为utf-8
2024-08-26 19:43:18
使用注意项:
原来文件格式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
最新文章
- .net基本数据类型操作
- USE “schema_name” in PostgreSQL
- 关于js的string的3个函数slice,substring,substr对比
- 微信开发学习日记(八):7步看懂weiphp插件机制,核心目标是响应微信请求
- HDU 1244 Max Sum Plus Plus Plus
- live 写博
- 服务器RAID配置全程与RAID基础知识
- 浅谈window.attachEvent
- storm第一篇--概念,例子,参数优化
- bzoj2876 [Noi2012]骑行川藏
- HDFS Architecture
- mstsc远程连接发生身份验证错误要求的函数不受支持
- centos7安装配置jdk
- logistic回归具体解释(二):损失函数(cost function)具体解释
- MySQL参数化查询的IN 和 LIKE
- 标签传播算法(Label Propagation)及Python实现
- c# 判断当前时间是否在某一时间段内
- 深入理解python中的yield关键字
- Final发布中间产物
- Java开发23种设计模式
热门文章
- linux 非root用户安装nginx
- Linux 反弹shell(二)反弹shell的本质
- Navicat连接MySQL数据库出现 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded
- 深度学习环境搭建(CUDA9.0 + cudnn-9.0-linux-x64-v7 + tensorflow_gpu-1.8.0 + keras)
- 【转】MarkDown添加图片的三种方式
- redis的生产环境中的部署?
- Redis中如何保证数据库和缓存双写时的数据的一致性?
- Office2016专业增强版永久激活
- 【一起来烧脑】底层HTTP深入笔记
- 【一起来烧脑】入门ES6体系