#!/usr/bin/env bash for word in $(grep -Roh '\w*' "$1" | sort | uniq) do echo "$(grep -lRw "$word" "$1" | wc -l) $word" done | sort -r