![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-12 04:00 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Discussion] Is there a convenient method for converting DOS and UNIX file formats? |
| Printable Version 1,517 / 12 |
| Floor1 honghunter | Posted 2008-01-10 14:13 |
| 中级用户 Posts 135 Credits 321 | |
|
Actually, I only need the one from UNIX to DOS, that is, '\n' -> '\r\n'
With the help of sed, the following way can achieve the effect: However, now I want to ask if there is a simpler method, preferably without using third-party tools. I already know the principle. The following is excerpted from: http://hi.baidu.com/dbsuit/blog/item/511eb409f9abe7266b60fba8.html [ Last edited by honghunter on 2008-1-10 at 02:15 PM ] |
|
| Floor2 不得不爱 | Posted 2008-01-10 15:53 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
Unix -> Dos
for /f "delims=" %i in (Unix.txt) do echo %i>>dos.txt That's it |
|
| Floor3 honghunter | Posted 2008-01-10 16:12 |
| 中级用户 Posts 135 Credits 321 | |
Originally posted by Must Love at 2008-1-10 03:53 PM: |
|
| Floor4 不得不爱 | Posted 2008-01-10 16:40 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
| Floor5 honghunter | Posted 2008-01-10 16:45 |
| 中级用户 Posts 135 Credits 321 | |
|
The source file only had line breaks, and the new file became "ECHO is on."
|
|
| Floor6 不得不爱 | Posted 2008-01-10 16:55 |
| 超级版主 Posts 2,044 Credits 5,310 From 四川南充 | |
|
That shouldn't be the case. Why don't I have that problem?
|
|
| Floor7 lxmxn | Posted 2008-01-10 17:00 |
| 版主 Posts 4,938 Credits 11,386 | |
|
将more myunix.txt>mydos.txt按照要求直接输出即可,因为这本身是英文相关操作命令,无需翻译,所以输出:more myunix.txt>mydos.txt
|
|
| Floor8 honghunter | Posted 2008-01-10 20:54 |
| 中级用户 Posts 135 Credits 321 | |
|
Thank you all. I'll try it again when I get to the company tomorrow.
|
|
| Floor9 weasel | Posted 2009-06-01 13:08 |
| 初级用户 Posts 66 Credits 118 | |
Originally posted by lxmxn at 2008-1-10 17:00: Solved a problem that had troubled me for a long time. Thanks to the moderator. It's amazing. I didn't know more had this function. [ Last edited by weasel on 2009-6-2 at 06:47 ] |
|
| Floor10 qqs09123 | Posted 2010-07-19 20:56 |
| 新手上路 Posts 8 Credits 8 | |
Originally posted by weasel at 2009-6-1 13:08: Similarly, if in a Unix system, using more dosfile>unixfile can also convert Windows format text to Unix format text. |
|
| Floor11 HAT | Posted 2010-07-20 13:24 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Which version of Unix did you test in?
|
|
| Floor12 qqs09123 | Posted 2010-07-20 16:05 |
| 新手上路 Posts 8 Credits 8 | |
Originally posted by HAT at 2010-7-20 13:24: It's not testing but using. It's the SCO Unix 5.0.5 version |
|
| Floor13 HAT | Posted 2010-07-21 10:39 |
| 版主 Posts 5,017 Credits 9,023 | |
|
You're really lucky, all my tests in the following systems failed:
Ubuntu, Solaris, AIX, FreeBSD |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |