tail -f path
The above will output modifications to the file instantly, but I want to apply a filter to the output, only show when there is a keyword xxx in it.
How to approach this?
feedback
|
|
With Unix you can pipe the output of oone program into another. So to filter tail, you can use grep tail -f path | grep xxx | |||||||
feedback
|
|
and you can use multiple pipes and greps, and exclude things with grep -v, get case insensitivity with grep -i, etc. i.e.: tail -100f /var/log/messages | grep -V ACPI | grep -i ata start tailing 100 lines from the end, and keep tailing, first exclude any lines with ACPI, then show lines with ata, ATA, or any mix of those. Another handy one is the ABC options, for the lines After, Before, and Context (lines before and after). | |||
|
feedback
|