我們都知道Linux上的文件下載到windows系統(tǒng)上格式就亂了, 那我們怎么辦那 ?現(xiàn)在我教大家一個簡單的方法來解決Linux系統(tǒng)的文件下載到windows系統(tǒng)上會出現(xiàn)的文件格式亂的情況。
10年積累的成都網(wǎng)站制作、成都網(wǎng)站建設(shè)經(jīng)驗,可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認識你,你也不認識我。但先網(wǎng)站設(shè)計后付款的網(wǎng)站建設(shè)流程,更有盈江免費網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
dos2unix命令用來將DOS格式的文本文件轉(zhuǎn)換成UNIX格式的(DOS/MAC to UNIX text fileformat converter)。DOS下的文本文件是以\r\n作為斷行標志的,表示成十六進制就是0D0A.而Unix下的文本文件是以\n作為斷行標志的,表示成十六進制就是0A.
DOS格式的文本文件在Linux底下,用較低版本的vi打開時行尾會顯示^M,而且很多命令都無法很好的處理這種格式的文件,如果是個shell腳本。而Unix格式的文本文件在Windows下用Notepad打開時會拼在一起顯示。因此產(chǎn)生了兩種格式文件相互轉(zhuǎn)換的需求,對應(yīng)的將UNIX格式文本文件轉(zhuǎn)成成DOS格式的是unix2dos命令。
unix2dos 和 dos2unix
名稱
unix2dos-UNIX 到 DOS 文本文件格式轉(zhuǎn)換器
新思科技
unix2dos [選項] [-c convmode] [-o 文件......][-n infile 文件的輸出......]
選項:
[-hkqV][— — 幫助][-keepdate][— — 安靜][— — 版本]
常用參數(shù):
-k :保留文件運來的格式。
-n :保留原本的舊文件,將轉(zhuǎn)換后的內(nèi)容輸出到新文件。
unix2dos 例子:
從 stdin 中獲得輸入和輸出寫到標準輸出。
unix2dos
轉(zhuǎn)換和替換 a.txt。轉(zhuǎn)換和替換 b.txt。
[root@localhost ~]# unix2dos a.txt b.txt
[root@localhost ~]# unix2dos -o a.txt b.txt
轉(zhuǎn)換和替換 a.txt 中 ASCII 轉(zhuǎn)換模式。轉(zhuǎn)換和
替換 b.txt 的 ISO 轉(zhuǎn)換模式。
[root@localhost ~]# unix2dos a.txt-c iso b.txt
[root@localhost ~]# unix2dos -c ascii a.txt -c iso b.txt
轉(zhuǎn)換和替換 a.txt 同時保持原始日期戳。
[root@localhost ~]# unix2dos -k a.txt
[root@localhost ~]# unix2dos -k -o a.txt
轉(zhuǎn)換 a.txt 和寫入 e.txt。
[root@localhost ~]# unix2dos -n a.txt e.txt
轉(zhuǎn)換 a.txt 和寫入相同,e.txt,e.txt 保持日期戳
a.txt。
[root@localhost ~]# unix2dos -k -n a.txt e.txt
轉(zhuǎn)換和替換 a.txt。轉(zhuǎn)換 b.txt 和寫入 e.txt。
[root@localhost ~]# unix2dos a.txt -n b.txt e.txt
[root@localhost ~]# unix2dos -o a.txt -n b.txt e.txt
轉(zhuǎn)換 c.txt 并寫入 e.txt。轉(zhuǎn)換和替換 a.txt。轉(zhuǎn)換
和替換 b.txt。轉(zhuǎn)換 d.txt 并寫入 f.txt。
[root@localhost ~]# unix2dos -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
dos2unix 例子:
從 stdin 中獲得輸入和輸出寫到標準輸出。
dos2unix
轉(zhuǎn)換和替換 a.txt。轉(zhuǎn)換和替換 b.txt。
[root@localhost ~]# dos2unix a.txt b.txt
[root@localhost ~]# dos2unix -o a.txt b.txt
轉(zhuǎn)換和替換 a.txt 中 ASCII 轉(zhuǎn)換模式。
[root@localhost ~]# dos2unix a.txt -c iso b.txt
轉(zhuǎn)換和替換 b.txt 的 ISO 轉(zhuǎn)換模式。
[root@localhost ~]# dos2unix -c ascii a.txt -c iso b.txt
Mac c.txt 轉(zhuǎn)換 Unix ascii 格式中。
[root@localhost ~]# dos2unix -c mac c.txt b.txt
轉(zhuǎn)換和替換 a.txt 同時保持原始日期。
[root@localhost ~]# dos2unix -k a.txt
[root@localhost ~]# dos2unix -k -o a.txt
轉(zhuǎn)換 a.txt 和寫入 e.txt。
[root@localhost ~]# dos2unix -n a.txt e.txt
轉(zhuǎn)換 a.txt 和寫入相同,e.txt,e.txt 保持日期戳
a.txt。
[root@localhost ~]# dos2unix -k -n a.txt e.txt
轉(zhuǎn)換和替換 a.txt。轉(zhuǎn)換 b.txt 和寫入 e.txt。
[root@localhost ~]# dos2unix a.txt -n b.txt e.txt
[root@localhost ~]# dos2unix -o a.txt -n b.txt e.txt
轉(zhuǎn)換 c.txt 并寫入 e.txt。轉(zhuǎn)換和替換 a.txt。轉(zhuǎn)換
和替換 b.txt。轉(zhuǎn)換 d.txt 并寫入 f.txt。
[root@localhost ~]# dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
當(dāng)前題目:Linuxdos2unix和unix2dos是的使用方法
當(dāng)前路徑:http://jinyejixie.com/article22/psehjc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、Google、微信公眾號、定制網(wǎng)站、品牌網(wǎng)站建設(shè)、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)