Do a tail -F until matching a pattern

后端 未结 10 1391
遥遥无期
遥遥无期 2020-11-28 09:21

I want to do a tail -F on a file until matching a pattern. I found a way using awk, but IMHO my command is not really clean. The problem is that I need to d

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 09:57

    ready to use for tomcat =

    sh -c 'tail -f --pid=$$ catalina.out | { grep -i -m 1 "Server startup in" && kill $$ ;}'

    for above scenario :

    sh -c 'tail -f   --pid=$$ /tmp/foo | { grep -i -m 1 EOF && kill $$ ;}'
    

提交回复
热议问题