linux 0a 0d,回车换行DOS-LINUX 0D 0A 问题

Dos 格式的文件,用 0D 0A (CR+LF)作为换行符,而Unix 的则是以0A(LF) 作为换行符,所以dos

底下的文本文件到了unix的话,换行符就会多出来一个 0D(CR) 显示为 ^M 。

2 。解决方法:

a. 传输时使用

ftp 的 asc mode

b. DOS/WIN中用编辑工具,转换成Unix格式再传到Unix

c. 直接用unix

提供的dos2unix 工具

[php]

man dos2unix

Reformatting page.  Please

Wait... done

User Commands

dos2unix(1)

NAME

dos2unix - convert text file from DOS

format to ISO format

SYNOPSIS

dos2unix [-ascii] [-iso]

[-7] [-437 | -850 | -860 |  -863  |

-865]  originalfile

convertedfile

DESCRIPTION

The dos2unix utility converts

characters in the DOS extended

character set to the

corresponding ISO standard characters.

This command can be

invoked from either DOS or  SunOS.  How-

ever,  the  filenames

must conform to the conventions of the

environment in which the

command is invoked.

If the original file and the converted

file  are  the  same,

dos2unix will rewrite the original file

after converting it.

...

[/php]

当然,也有unix2dos工具……

4。用vi /

sed 也可进行替换

s/^M$//

阅读(2965) | 评论(0) | 转发(0) |

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值