更新时间:2022-12-09 21:28:47
尝试使用 count()函数,例如:
count()
xmlstarlet sel -t -c "count(//ThreadGroup)" xmlfile
在格式正确的 xml 文件(不是您的情况)中,它会产生:
xml
In a well-formed xml file (not your case) it would yield:
3
如何计算XML中的元素数量?
使用xpath计算XML中的元素数量
如何使用BASH中的xmlstarlet计算XML文档中的元素数量?