China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-06 22:58
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Help] Read content into another text file View 2,173 Replies 6
Original Poster Posted 2010-05-19 14:05 ·  中国 上海 图像数据通信有限公司
新手上路
Credits 4
Posts 4
Joined 2010-05-18 16:28
16-year member
UID 167120
Gender Male
Status Offline
"
PK_tag_BATCH.pck







PK_ORPHAN_BATCH.pck

"
Everyone, this is the content of a text file. How do I read out the content between and , and then store it in another text file? Use FOR and IF in DOS to read out the content between each heading.

[ Last edited by mlroger on 2010-5-20 at 16:18 ]
Floor 2 Posted 2010-05-20 00:09 ·  中国 重庆 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 3 Posted 2010-05-20 16:09 ·  中国 上海 图像数据通信有限公司
新手上路
Credits 4
Posts 4
Joined 2010-05-18 16:28
16-year member
UID 167120
Gender Male
Status Offline
I still don't understand.
Floor 4 Posted 2010-05-21 14:38 ·  新加坡
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
What part don't you understand?
Floor 5 Posted 2010-05-21 16:42 ·  中国 上海 图像数据通信有限公司
新手上路
Credits 4
Posts 4
Joined 2010-05-18 16:28
16-year member
UID 167120
Gender Male
Status Offline
Is SED a DOS command? I want to use DOS for to read the contents of *.TXT, then use IF to check the content in between and display it. Combine FOR and IF, checking them one by one.
Floor 6 Posted 2010-06-03 13:59 ·  中国 上海 联通
新手上路
Credits 16
Posts 17
Joined 2008-04-08 14:54
18-year member
UID 115249
Gender Male
Status Offline
type *.txt | tee test.txt
*.txt is the original file
test.txt is the newly generated file, and its content is the same as *.txt.
Floor 7 Posted 2010-09-24 13:12 ·  中国 江苏 苏州 电信
新手上路
Credits 13
Posts 15
Joined 2010-09-18 21:51
15-year member
UID 174432
Gender Male
Status Offline
It's best to make a batch file compfile.bat;
the parameters %1, %2, %3, %4 in it are finename.txt, new.txt, startstring, endstring
For any similar operation, just call compfile "finename.txt" "new.txt" "startstring" "endstring"
Then the OP can use call compfile temp.txt tempnew.txt "[CTRL]" "[VIEW]"
Which expert can improve compfile.bat? I need it urgently too!
Of course I haven't considered special characters in the call parameters such as []%&
Forum Jump: