下面是我的示例xml
<parent1>
<child1>test1</child1>
<child2>test2</child2>
<child3>test3</child3>
</parent1>
<parent2>
<child1>test1</child1>
<child2>test2</child2>
<child3>test3</child3>
</parent2>
<parent3>
<child1>test1</child1>
<child2>test2</child2>
<child3>test3</child3>
</parent3>
现在我想找到下面组合的发生次数
<child1>test1</child1>
<child3>test3</child3>
我试过下面的命令
findstr /R /c:"<child1>test1</child1>.*<child3>test3</child3>*" test.xml
但它希望child1和child3都是单行。
因为它在不同的行,它没有给任何计数。
有人可以帮我找出窗口命令来满足这个要求。
提前致谢。
你必须搜索<child1>test1</child1>
或<child3>test3</child3>
:
@echo off
findstr /n /r /c:"<child1>test1</child1>" /c:"<child3>test3</child3>" data4.xml | find /c ":"
使用/C
的参数find
,您可以获得结果数。