dos,unix格式文件转换
来源:互联网 发布:web数据挖掘技术 编辑:程序博客网 时间:2024/05/20 11:50
转:dos,unix格式文件转换
The UNIX end-of-line character is a line feed/newline character (/n). The DOS/Windows end-of-line character is a carriage return, followed by a line feed/newline (/r/n).Most editors can automatically convert these to the appropriate format, but others, such as Notepad in Windows, cannot.
To convert a UNIX file to DOS usingsed(GNUsed3.02.80 or later):
$ sed 's/$//r/' UNIX_file > DOS_file
To convert a DOS file to UNIX file, usetrto remove the carriage return:
$ tr -d '/r' < DOS_file > UNIX_file
To accomplish the same thing using sed:
$ sed 's/^M//' DOS_file > UNIX_file
Note: To generate the^Mabove, pressCtrl-V, thenCtrl-M.
FTP'sASCIItransfer mode will automatically do the end-of-line conversion between DOS and UNIX systems.
Also, the commands dos2unixandunix2dosmay be used to perform. the conversion, if present on your system.
- Emacs
You can also convert aDOSfile nameddosfile.txt
to aUnixtext file usingEmacs, aUnixtext editor. Enter at theUnixshell prompt:emacsdosfile.txt
This will open the file in theEmacstext editor. To remove all the "^M" characters, typeM-% C-q C-m RET RET !
It may also be necessary to remove aCtrl-z
at the end of the document. To quickly get to the end of the document inEmacs, typeM->
If you see aCtrl-z
at the end of the document, delete it.
To convert aUnixfile namedunixfile.txt
to aDOStext file, first open it inEmacs. At theUnixshell prompt, enteremacsunixfile.txt
This will open the file in theEmacstext editor. To add carriage returns, which will show up as^M
inEmacs, typeM-% C-q C-j RET C-q C-m C-q C-j RET !
It may also be necessary to add aCtrl-z
at the end of the document. At the very end of the document, pressC-q C-z
- dos,unix格式文件转换
- Unix格式文件转Dos
- 在Linux中DOS格式的文件和unix格式文件的相互转换
- Linux命令之dos2unix - DOS格式文本文件UNIX格式文件的转换
- dos格式文件传输到unix系统
- 简要介绍一下Dos/Windows格式文件和Unix/Linux格式文件
- 批量转换(unix->dos)
- windows>solaris -- dos格式文件转化为unix格式
- dos和unix文件格式转换
- 在linux下,去除^M,将windows格式文件(dos文件)改为unix格式文件
- 普通dos编码文件批量转换为UTF-8格式文件
- dos文件转换成unix文件格式
- DOS文件格式转换成unix文件格式
- DOS文件转换成UNIX文件格式
- dos文件格式转换为Unix文件格式
- Dos和Unix的换行 转换
- DOS文件转换成UNIX文件格式详解
- dos文件和unix文件的转换
- 表中一行数据被锁定了不能修该请问解锁的方法
- 一个程序员的奋斗历程.(转)
- 面对客户,如何做公司(工作室)介绍?
- GridView 中DataKeyNames 存储数据键值
- com.microsoft.sqlserver.jdbc.SQLServerException 将截断字符串或二进制数据问题
- dos,unix格式文件转换
- ASP.Net生成多彩下拉框
- 今天离婚,你得抱我出门
- UVa Problem Solution: 843 - Crypt Kicker
- onbeforeunload 的使用
- SQL Server 2005 重装时报:对性能监视器计数器注册表值执行系统配置检查失败
- eclipse下的tomcat突然无法启动——报端口已被占用或tomcat已经开启错误
- C#完整的通信代码(点对点,点对多,同步,异步,UDP,TCP)
- 梅花雪树控件的使用及下载