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"
精彩评论