Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 捕捉线路并发布_Linux_Bash_Curl_Awk - Fatal编程技术网

Linux 捕捉线路并发布

Linux 捕捉线路并发布,linux,bash,curl,awk,Linux,Bash,Curl,Awk,有一个日志文件,我需要捕获其中的特定行,并将其中的特定单词发送到url 此行的任务是跟踪该日志文件并查找该单词 tail -f /var/log/mail.log | awk '/status=bounced/ { sub(/^to=</,"",$7); sub(/>,$/,"",$7); print $7}' tail-f/var/log/mail.log | awk'/status=bounched/{sub(/^to=,$/,“”,$7);打印$7}” 现在,我需要将$7的

有一个日志文件,我需要捕获其中的特定行,并将其中的特定单词发送到url

此行的任务是跟踪该日志文件并查找该单词

tail -f /var/log/mail.log | awk '/status=bounced/ { sub(/^to=</,"",$7); sub(/>,$/,"",$7); print $7}'
tail-f/var/log/mail.log | awk'/status=bounched/{sub(/^to=,$/,“”,$7);打印$7}”
现在,我需要将$7的结果发送到某个url,我假设使用curl。 假设这个日志文件只会越来越大,而且这个脚本需要在后台无休止地运行

放置能够满足这些需求的bash脚本的最佳方式是什么


谢谢

一旦编写了将输出发送到url的脚本,就可以使用crontab定期运行该脚本。我缺少的是将其发送到url的部分。。怎么做有点麻烦你是说这样的吗。您可以将awk的输出作为参数导入curl,然后通过运行cronjob,指向您编写的脚本,定期运行curl。如果您能帮助我将其整理成一个可用的bash脚本,我将不胜感激:)