List the number of primary shards per data node in Elasticsearch:
curl -s localhost:9200/_cat/shards?h=node,prirep | awk '
$2 == "p" {
result[$1] += 1; total += 1
}
END {
for (var in result)
printf "%s\t%s (%0.2f%%)\n",var,result[var],result[var]/total*100
}'
It's not exactly a one-liner but I tried to make the AWK somewhat legible.