If I understand what you want to do right, then
grep -oE 'Man-[0-9]+' filename | sort | uniq -c
gotta do the trick. It works as follows: First
grep -oE 'Man-[0-9]+' filename
isolates all words from a file matching the regular expression Man-[0-9]+ . This list is then passed through sort to get the sorted list that uniq needs, and then the sorted list is sent through uniq -c to count how often each unique Man- word appears.
source share