Question : korn shell pattern match 3 expressions using grep

IN a file I need to check for 3 patterns if all the 3 patterns are in the file. I need to send out an email. All this needs to be done in korn shell script. Please advise.

Answer : korn shell pattern match 3 expressions using grep

Easiest way (if it's not a large file that will take a long time to search) is to do 3 separate greps:

if (grep pattern1 file && grep pattern2 file && grep pattern3 file) >/dev/null; then
   echo message | mailx -s "Found pattern" [email protected]
fi
Random Solutions  
 
programming4us programming4us