I have a file like below.
Name1 IM123
Name2 IM145
Name1 IM901
I want to count the number of occurrences of the name.
You could try the following:
For specifically Name1:
$ awk '$1 ~ /Name1/ {++c} END {print c}' FS=" " file_name.txt
For all names:
$ awk '{count[$1]++}END{for(j in count) print j,"("count[j]" times)"}' FS=" " file_name.txt
Hope that helps!