2
Linux常用命令-99:dos2unix
source link: https://xugaoxiang.com/2022/09/07/linux-cmds-99-dos2unix/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
dos2unix
命令用来将 DOS
格式的文本文件转换成 UNIX
格式。DOS
下的文本文件是以 \r\n
作为换行标志,表示成十六进制就是 0D 0A
,而 UNIX
下的文本文件是以 \n
作为换行标志,表示成十六进制就是 0A
。将文件从 windows
系统拷贝到 linux
系统中,经常会出现显示格式的问题,与之相对应的是命令 unix2dos
。
语法格式:dos2unix [参数] [文件]
常用参数:
# 直接转换格式
dos2unix test.py
# 多个文件一起转换
dos2unix test1.py test2.py test3.py
# 转换后生成新的文件,保留原来的文件
dos2unix -n oldfile newfile
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK