创建脚本及其在sample.txt中的写入,无法grep以下文本“EX_R02”并且需要发送邮件。
cat sample.txt|mailx -a sample.txt -s "GG status Report" $MAIL_LIST
Sample.txt
:
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT STOPPED EX_R02 00:00:03 01:10:37
答案1
如果您的“grep 下面的文本EX_R02
”意思是“grep 下面的文本EX_R02
”,那么您只需将您的替换cat
为grep "EX_R02"
:
grep "EX_R02" sample.txt | mailx -a sample.txt -s 'GG status Report' "$MAIL_LIST"