#! /bin/bash logfile=/path/to/logfile.log # search and count lines beginning (^) with "1L" if [ $( grep -c "^1L" $logfile ) -gt 30 ]; then mail -s "Warning: too many 1L entries" admin@example.org <