windows下文档格式转换 为unix文档格式注意事项
来源:互联网 发布:音乐盒淘宝 编辑:程序博客网 时间:2024/06/02 05:30
1、windows使用dos模式结尾,unix采用unix格式结尾。
find -name "*.h" -o -name "*.cpp" | xargs dos2unix
2、windows一般使用GBK编码格式,linux采用utf-8格式。解决办法:
#!bin/bash
if [ -f "tmp.log" ]; then
rm tmp.log
fi
find -name "*.cpp" -o -name "*.h" -o -name "*.jce"|xargs file -i|grep 8859|awk '{print $1}' >> tmp.log
cat tmp.log | while read line
do
var=${line:0:(${#line}-1)}
echo $var
iconv -f GBK -t utf-8 $var -o $var'.bak' && rm $var && mv $var'.bak' $var
done
rm tmp.log
3、综合性语句:技能把dos转换为unix又能把GBK格式转换为utf-8格式
#!bin/bash
pwd
find -name "*.cpp" -o -name "*.h" | xargs file -i|grep 8859|awk '{print $1}' >> tmp.log
cat tmp.log | while read line
do
var=${line:0:(${#line}-1)}
echo $var
iconv -f GBK -t utf-8 $var -o $var'.bak' && rm $var && mv $var'.bak' $var
done
rm tmp.log
find -name "*.h" -o -name "*.cpp"|xargs file| grep CRLF| awk '{print $1}' >> tmp.log
cat tmp.log | while read line
do
var=${line:0:(${#line}-1)}
echo $var
dos2unix $var
done
rm tmp.log
- windows下文档格式转换 为unix文档格式注意事项
- DOS/Windows和Linux/Unix间的文档格式转换
- 文档格式转换(win,unix\linux,mac)
- 转换Linux man 文档为txt格式
- Anakia 转换xml文档为其他格式
- 文档格式转换--JodConverter
- 把ppt格式的文档转换为pdf格式
- Windows下硬盘转换为NTFS格式
- unix格式转换成windows格式
- 各种文档格式转换库
- 文档转换成PDF格式
- 文档格式转换利器XDocIO
- Windows下将Word文档转换为PDF文档
- [COCOON+Jfor]将FO转换为RTF格式文档
- [COCOON+Jfor]将FO转换为RTF格式文档
- PowerPoint文档转换为Flash格式软件介绍
- [COCOON+Jfor]将FO转换为RTF格式文档(二)
- [COCOON+Jfor]将FO转换为RTF格式文档(二)
- Find a way
- 洗牌算法Fisher–Yates shuffle
- apk打包
- HDU5692 Snacks DFS序 线段树
- java-算法的基本定义
- windows下文档格式转换 为unix文档格式注意事项
- #761 – FlowDirection如何影响HorizontalContentAlignment(How FlowDirection Affects HorizontalContentAlign)
- jsp+javaBean+servlet+mysql完整的实现一个登录功能
- 计蒜课 跳跃游戏
- 你使用Rxjava时,内存泄漏了吗?
- 使用ADB遇到的问题
- android databinding不出现具体错误':app:compileDebugJavaWithJavac'. > Compilation failed;
- 申请深圳户口真他妈麻烦
- lintcode Permutation Index