you could try writing a map/reduce script
# inventory
a
you could try writing a map/reduce script