dos2unix, unix2dos 對應指令

| | Comments (0)

dos2unix, unix2dos 用在 DOS <=> UNIX text file 轉換
DOS 格式 0d 0a
UNIX 格式 0a
有時手邊無此工具, 可用功能相同的指令組合
dos2unix:
sed -i "s/\r//" file
or
cat file | col -b > newfile
or
cat file | tr -d "\r" > newfile
cat file | tr -d "\015" > newfile

unix2dos:
sed -i "s/$/\r/" file
sed -i "s/$/\x0d/" file

以上適用 GNU sed, FreeBSD 下的 sed 不適用

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on May 28, 2004 11:25 AM.

GPART was the previous entry in this blog.

Yellowtip (apache, php, mysql 3 in 1 server for win) is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.