Say I want to grab the last 5 mentions of cron in /var/log/syslog.log looking over the grep manual it seems like I can't get grep to search in reverse. I can however grab the most recent occurrences.grep cron -m 5 /var/log/syslogIs there a reverse grep command I can use? :)
Reverse grep to get the last couple of occurrences in a file
grep
Following the usual unix philosophy of combining tools: use grep to search, and tail to return the last part of the file.grep cron /var/log/syslog | tail -n 5