- dos2unix是將Windows格式文件轉換爲Unix、Linux格式的實用命令。Windows格式文件的換行符爲\r\n ,而Unix&Linux文件的換行符爲\n. dos2unix命令其實就是將文件中的\r\n 轉換爲\n。
- 而unix2dos則是和dos2unix互爲孿生的一個命令,它是將Linux&Unix格式文件轉換爲Windows格式文件的命令。
在使用前要先安裝dos2unix
yum install -y dos2unix
命令語法:
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
unix2dos [options] [-c convmode] [-o file ...] [-n infile outfile ...]
簡單用法:
dos2unix xxx.sh