Bash 2 tail-f具有不同的命令

Bash 2 tail-f具有不同的命令,bash,parsing,logging,Bash,Parsing,Logging,我正在尝试制作一个shell脚本来监视日志文件,但我有一个问题,我不能同时执行两个tail。 该脚本基本上是搜索一个词,如果它匹配它将重定向的3行包括匹配的词到一个文件中,然后我将修剪无用的信息提取我想要的。 我尝试了下面的命令,它的工作很好,但当我在一个文件中幻影它不工作 请告知:) 下面是脚本的一部分 #!/bin/bash #grep error log tail -f /FileLogging.log | grep 'error' >>/home/he

我正在尝试制作一个shell脚本来监视日志文件,但我有一个问题,我不能同时执行两个tail。
该脚本基本上是搜索一个词,如果它匹配它将重定向的3行包括匹配的词到一个文件中,然后我将修剪无用的信息提取我想要的。 我尝试了下面的命令,它的工作很好,但当我在一个文件中幻影它不工作 请告知:) 下面是脚本的一部分

  #!/bin/bash
    #grep error log
    tail -f /FileLogging.log  | grep  'error' >>/home/hello/tech.txt
    #pruning useless information 
    tail -f /home/hello/tech.txt perl -nle "print $1 if /sam-(.+?)\",\"jack/" >>/home/hello/non.txt

现在我检测到,只有一个源被监视。因此,此命令应结合您的示例:

tail -f /FileLogging.log | grep 'error' | tee -a /home/hello/tech.txt | perl ... >>/home/hello/non.txt

|
perl
之前丢失?将第一个放在后台:
tail-f/FileLogging.log | grep'error'>/home/hello/tech.txt&
或将这三个命令连接在一起。注意缓冲问题可能会发生,也可能不会发生,但这仍然是一件事。