开发者

How do I make a very basic file filter using grep?

开发者 https://www.devze.com 2023-03-18 17:51 出处:网络
A really simple question, but I couldn\'t find a simple answer here on SO. I have a log file my.log where some lines contain the word \"User\". How can I make a grep command to run constantly and ou

A really simple question, but I couldn't find a simple answer here on SO.

I have a log file my.log where some lines contain the word "User". How can I make a grep command to run constantly and output every time the log is updated with开发者_如何学Python a line containing the word "User"? Thanks.


tail -f my.log | grep User

tail -f watches the file and outputs any lines added to the end


You're right, it's simple:

tail -f my.log | grep "User"
0

精彩评论

暂无评论...
验证码 换一张
取 消