Mac OS X,  Ubuntu,  Unix

Count Log Entries for a Pattern

You see a lot of entries for various things in log files. Here, we’re going to print out the number of entries with backupd in them:

awk '/backupd/{print NR}' /var/log/system.log