Unix 搜索字符串并发送邮件

Unix 搜索字符串并发送邮件,unix,Unix,我需要帮助为下面的逻辑编写脚本 egrep -i '06:00|06:01|06:02' GSEQOPT2015-12-10.log|grep 'Heatbeat' 2015-12-10 06:00:31,419 INFO out.GCPRS_ENGINE - >2 Heartbeat 2015-12-10 06:00:47,747 INFO in.GXPRTS_ENGINE - <2 Heartbeat 白鹭-i'06:00 | 06:01 | 06:02'G

我需要帮助为下面的逻辑编写脚本

egrep -i '06:00|06:01|06:02' GSEQOPT2015-12-10.log|grep 'Heatbeat'   
2015-12-10 06:00:31,419 INFO  out.GCPRS_ENGINE - >2 Heartbeat  
2015-12-10 06:00:47,747 INFO  in.GXPRTS_ENGINE - <2 Heartbeat   
白鹭-i'06:00 | 06:01 | 06:02'GSEQOPT2015-12-10.日志| grep'Heatbeat' 2015-12-10 06:00:31419 INFO out.GCPRS_ENGINE->2心跳 2015-12-10 06:00:47747.GXPRTS\u引擎中的信息- 您可以在此处找到有关使用linux命令发送邮件的更多帮助:
()

如果答案解决了您的问题或对您有积极帮助,请接受。它可能对其他人有用。祝你一切顺利
#!/bin/bash
if grep -F "SomeString" "$File"; then
    sendmail user@example.com  < /tmp/email.txt 
fi
Subject: XYZ
line 1
line 2