简体   繁体   English

结合grep和sendmail

[英]Combining grep and sendmail

I am looking for a way using the command line in UNIX to email the results from a grep command. 我正在寻找一种使用UNIX中的命令行通过grep命令通过电子邮件发送结果的方法。

I am grepping the error logs looking for a "searchword". 我在错误日志中寻找“搜索词”。 I temporarily want to email the results to my work account. 我暂时想将结果通过电子邮件发送到我的工作帐户。 This is a temporary solution until the SA has the time to write a script that will write it to a file where the file will be read by an automated analyzing program. 这是一个临时解决方案,直到SA有时间编写将脚本写入文件的脚本,该脚本将由自动分析程序读取该文件。

sendmail joetester@workemail.com < grep searchword error* 

Does anyone have an idea on how to do it that they can share. 有谁知道如何分享的想法。 Thank you. 谢谢。

You want something like grep searchword error* | sendmail joetester@workemail.com 您想要类似grep searchword error* | sendmail joetester@workemail.com grep searchword error* | sendmail joetester@workemail.com , see this question . grep searchword error* | sendmail joetester@workemail.com ,请参阅此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM