The following example counts the times I am mentioned without needing the lastloggedin file:
$ last | awk '$1=="yeti" { ++count } END { print count }'
106
If you insist in oreusing or are forced to use the lastloggedin file, you can do it this way:
$ last > lastloggedin
$ awk '$1=="yeti" { ++count } END { print count }' lastloggedin
106
Use $1~/some_chars/ to get all user names containig the given chars or $1~/^prefix/ to match only names starting with prefix:
$ last | awk '$1~/et/ { ++count } END { print count }'
106
$ last | awk '$1~/^ye/ { ++count } END { print count }'
106
P.S.:
Scan man awk for more hints... ;-)
awk is very rewarding: You can do lots of stuff after a very short time of learning...