转换windows下的文本文件为linux系统的格式
使用cat -A test.txt能看到^M,即Windows平台下的回车\r
vim test.txt:set ff?
结果fileformat=dos
更改格式::set ff=unix:set ff?
结果fileformat=unix:wq
使用cat -A test.txt不会看到^M
另一种方案sed -e 's/.$//' test.txt>test1.txt,.$匹配行尾的字符,(.不会匹配到\n),windows dos格式的行尾就是^M\n;将^M替换为空
批量转换目录中的文件从dos格式到unix格式,apt install dos2unix,for x in $(find . -type f ); do dos2unix $x $x ; done
创建于2023.3.20/20.37,修改于2023.3.27/11.33