|
lovecissi
初级用户
 
积分 40
发帖 8
注册 2006-5-28
状态 离线
|
『楼 主』:
请教如何拼接文本?
使用 LLM 解释/回答一下
我有两个文件
1.txt
内容为 111111
2.txt
内容为 222222
当我用 type d:\1.txt >> 2.txt 时,显示2.txt内容为
2222221111111
请问如何才能在两者之间插入回车符,使得2.txt的内容为
222222
111111
请教各位前辈?
I have two files:
1.txt with content: 111111
2.txt with content: 222222
When I use type d:\1.txt >> 2.txt, the content of 2.txt is displayed as 2222221111111.
How can I insert a carriage return between them so that the content of 2.txt is:
222222
111111
Please teach the seniors?
|
|
2006-6-23 21:52 |
|
|
不得不爱
超级版主
         我爱DOS
积分 5310
发帖 2044
注册 2005-9-26 来自 四川南充
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
你那是在1.txt和2.txt里没有插入回车符引起的!
可以用下面的命令:
type 2.txt|find/v "">3.txt
del 2.txt
ren 3.txt 2.txt
type 1.txt|find/v "">>2.txt
That's caused by not inserting line breaks in 1.txt and 2.txt!
You can use the following command:
type 2.txt|find/v "">3.txt
del 2.txt
ren 3.txt 2.txt
type 1.txt|find/v "">>2.txt
|

我的网络U盘 我的网络第2个U盘
论坛软件下载链接
灵雨飘零论坛
论坛新手必读,所有人的基本行为准则
刷QQ空间人气、留言的小软件 |
|
2006-6-24 11:39 |
|
|
lovecissi
初级用户
 
积分 40
发帖 8
注册 2006-5-28
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
非常感谢~~~非常感谢·~~~~
你是我的恩人
Thank you very much~~~~Thank you very much~~~~~You are my benefactor
|
|
2006-6-24 12:35 |
|
|
bagpipe
银牌会员
     DOS联盟捡破烂的
积分 1144
发帖 425
注册 2005-10-20 来自 北京
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
more <d:\1.txt>> 2.txt这样也应该可以的
This should also be okay: more <d:\1.txt>> 2.txt
|
|
2006-6-24 15:13 |
|
|
flysp
中级用户
  
积分 207
发帖 41
注册 2004-10-24
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
for /f %i in (d:\1.txt) do @echo %i >>d:\2.txt
for /f %i in (d:\1.txt) do @echo %i >>d:\2.txt
|
|
2006-6-24 20:42 |
|
|
willsort
元老会员
         Batchinger
积分 4432
发帖 1512
注册 2002-10-18
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
Re Upstairs:
以上各位回答的将问题复杂化了,一个回车标记使用单独使用echo.就可以添加了。
echo.>>2.txt
type d:\1.txt >> 2.txt
Re Upstairs:
The above answers from everyone have complicated the problem. A single carriage return can be added using echo alone.
echo.>>2.txt
type d:\1.txt >> 2.txt
|

※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得! |
|
2006-6-24 22:39 |
|
|
amao
中级用户
  
积分 316
发帖 152
注册 2006-6-18
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
sed "r 1.txt" 2.txt
不管2.txt原文本最后有无回车符都行
Last edited by amao on 2007-2-3 at 02:01 PM ]
sed "r 1.txt" 2.txt
It doesn't matter whether there is a carriage return at the end of the original text in 2.txt or not
Last edited by amao on 2007-2-3 at 02:01 PM ]
|
|
2007-2-3 13:59 |
|