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-13 02:58
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » [Help] Can Find search for multiple strings in a file at the same time? View 782 Replies 3
Original Poster Posted 2003-07-20 00:00 ·  中国 广东 肇庆 电信
高级用户
★★
Credits 578
Posts 135
Joined 2003-07-10 00:00
23-year member
UID 6709
Gender Male
Status Offline
For example: can it search for the two strings cde and ghi in abc.txt at the same time? If so, what should the command format be?
Floor 2 Posted 2003-07-20 00:00 ·  中国 广东 肇庆 电信
高级用户
★★
Credits 578
Posts 135
Joined 2003-07-10 00:00
23-year member
UID 6709
Gender Male
Status Offline
Also, why can't it be executed like this in a batch file?
for %%a in (c: d: e do dir %%a\ >>%ramdrive%\abc.txt | find "bytes free" %ramdrive%\abc.txt

But it has to be split up like below before it can run. Why?

for %%a in (c: d: e do dir %%a\ >>%ramdrive%\abc.txt

find "bytes free" %ramdrive%\abc.txt



Floor 3 Posted 2003-07-20 00:00 ·  中国 广东 肇庆 电信
高级用户
★★
Credits 578
Posts 135
Joined 2003-07-10 00:00
23-year member
UID 6709
Gender Male
Status Offline
And also this:
Floor 4 Posted 2003-10-31 00:00 ·  中国 山东 烟台 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re hzy:

Question 1: FIND "cde" abc.txt | FIND "ghi"

Question 2: FOR is not a single command, so it does not support command-line pipe operations, so anything after | is ignored

Question 3: FIND "free" < e:\abc.txt
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: