Grep only n lines and only n results

# head -10 log.txt | grep <whatever>

Example for plesk mail log

# head -n 10 /usr/local/psa/var/log/maillog | grep @domain.com

Return 10 results

# grep -m 10 @domain.com /usr/local/psa/var/log/maillog

Leave a Comment