技術: 2010年3月アーカイブ
▼違い
unix LF \n
Mac CR \r
Windows CR+LF \r\n
▼調べ方
od -c foo.txt
▼変換
Win => UNIX
% perl -pe 's/\r\n/\n/' winfile > unixfile
Win => Mac
% perl -pe 's/\r\n/\r/' winfile > macfile
UNIX => Win
% perl -pe 's/\n/\r\n/' unixfile > winfile
UNIX => Mac
% perl -pe 's/\n/\r/' unixfile > macfile
Mac => UNIX
% perl -pe 's/\r/\n/g' macfile > unixfile
Mac => Win
% perl -pe 's/\r/\r\n/g' macfile > winfile▼参考
http://www.rsch.tuis.ac.jp/~mizutani/online/with-pc/textline.html




















