转换行结束 [英] Convert line endings

查看:137
本文介绍了转换行结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用 D2U 转换行结束。安装Linux的小狗后,我
注意到它不来与 D2U ,但 DOS2UNIX的。然后,我注意到,
Ubuntu的默认情况下,既缺少

I have been using d2u to convert line endings. After installing Puppy Linux I noticed that it does not come with d2u, but dos2unix. Then I noticed that Ubuntu is missing both by default.

什么是另一种方式来转换行结束?

What is another way to convert line endings?

推荐答案

SED能就地转换做

# remove carriage return
sed -i 's/\r//' CRLF.txt

# add carriage return
sed -i 's/$/\r/' LF.txt

更多信息


-i    edit files in place 

有用的单行脚本SED

这篇关于转换行结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆