开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜