Is it possible to use Grep to search a file and send a email based on the results?I have been usinggrep SEARCHSTRING /logs/error_log | mailx -s subject name@emailaddress.co.ukBut I don't want it to send an email when Null it met (No results found) 
grep to search error_log and email only when results found?
grep
You can run mailx if the grep command returns success i.e. match is found:body=$(grep SEARCHSTRING /logs/error_log) && echo $body | mailx -s subject name@emailaddress.co.ukSaving the output of grep (if any) to variable body, if the grep command succeeds then mailx will be run with $body as the body of the mail.