Given a log file with thousands of entries, how would you write a bash script to parse out and count the most frequent error codes?