How to make tail display only the lines that have a specific text? How to make tail display only the lines that have a specific text? unix unix

How to make tail display only the lines that have a specific text?


You can do

tail -f mylogfile.log | grep "error: "

This works with regular expressions too. In general, you can take the output of any command, add | to "pipe" it to grep, and let grep filter out the lines that don't match a certain pattern.