Read each line and use regex to search for their name. I guess you search for < $+ $nick $+ > and then increase a counter if there is a match