1#!/bin/sh 2# Count elements matching XPath expression 3./xmlstarlet sel -T -t -v "count(/xml/table/rec/numField)" xml/table.xml 4