How do you pipe input through grep to another utility?

前端 未结 3 1970
北海茫月
北海茫月 2020-12-08 14:29

I am using \'tail -f\' to follow a log file as it\'s updated; next I pipe the output of that to grep to show only the lines containing a search term (\"org.springframework\"

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 15:06

    On my system, about 8K was buffered before I got any output. This sequence worked to follow the file immediately:

    tail -f logfile | while read line ; do echo "$line"| grep 'org.springframework'|cut -c 25- ; done
    

提交回复
热议问题