0
我有一個名爲的文本文件,file.txt
其中包含,如何從文本文件中找到相同的特定單詞並將其表示爲輸出?
A: - No such Root Directory
B: - No such Root Directory
C: - Fixed Drive
D: - Fixed Drive
E: - Removable Drive
F: - CD-ROM Drive
G: - Removable Drive
H: - No such Root Directory
I: - No such Root Directory
J: - No such Root Directory
K: - No such Root Directory
M: - No such Root Directory
N: - No such Root Directory
O: - No such Root Directory
P: - No such Root Directory
Q: - No such Root Directory
R: - No such Root Directory
S: - No such Root Directory
T: - No such Root Directory
U: - No such Root Directory
V: - No such Root Directory
W: - No such Root Directory
X: - No such Root Directory
Y: - No such Root Directory
Z: - No such Root Directory
在這個文件中,你可以看到詞Removable
出現兩次在第5行和第7行
如果有相同的特定的詞Removable
兩次或三次需要顯示輸出已有Removable word found multiple times
。
如果它沒有相同的特定字Removable
兩次或三次它需要顯示輸出有There is no multiple Removable word found
。
對於這種輸出我已經運行下面的程序,
findstr /b Removable "file.txt" do (
echo Removable word found multiple times
) || (
echo There is no multiple Removable word found
)
pause
我知道它錯了。但是,我盡力了。請糾正我的朋友。它會對我很有幫助。