Linux 與 Windows 的文字檔在換行符號上不同。若直接把 Linux 的 txt 放到 Windows,可能會發現所有內容擠在同一行。要解决这个问题,可以手動轉換換行格式。
cp unixfile.txt winfile.txt vi winfile.txt :set ff=dos :wq
這樣可把檔案格式改為 dos 換行,Windows 就能正常辨識。
sed -e 's/$/\r/' unixfile.txt > winfile.txt
執行後,把 winfile.txt 放到 Windows 系統即可。這個做法能在 Windows 中保留原本在 Linux 下的分行結構。
本文出自 “linux” 博客,請務必保留此出處https://yangzhiming.blog.51cto.com/4849999/1859941