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-04 19:23
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Help with partially batch-copying text documents View 717 Replies 2
Original Poster Posted 2007-05-27 22:39 ·  中国 上海 中国科学院上海应用物理研究所
新手上路
Credits 6
Posts 2
Joined 2007-05-27 21:58
19-year member
UID 89506
Gender Male
Status Offline
I have many text documents, “testi.txt” (i=1:n). In all the text documents there is one unique characteristic string, for example “machine parameter”. I want to copy everything from this characteristic string to the end of the document into another text document (including the characteristic string itself), and not keep anything before the characteristic string. I want to make this into a batch file under DOS, please help!!
Thanks, everyone!!
Floor 2 Posted 2007-05-27 23:52 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
@echo off
for %%a in (test*.txt) do (
sed -n "/machine parameter/,$p" %%a|more>>new.txt
)

#Sed download post #17
http://www.cn-dos.net/forum/viewthread.php?tid=30573
Floor 3 Posted 2007-05-28 17:39 ·  中国 上海 中国科学院上海应用物理研究所
新手上路
Credits 6
Posts 2
Joined 2007-05-27 21:58
19-year member
UID 89506
Gender Male
Status Offline
Many thanks indeed, moderator :P
Forum Jump: