I am trying to tail a user in production log.
Is it possible to use
tail -f grep "username"
Yes - You use pipe. i.e.
tail -f <some filename> | grep 'username'
Yes, you can just use a pipe
tail -f fileName | grep username
The ack
command, which is a grep-like text finder, has a --passthru
flag that is designed specifically for this.
Since ack
automatically color codes matches for you, you can use it to search the output of a tailed log file, and highlight the matches, but also see the lines that don't match.
tail -f error.log | ack --passthru whatever
All the lines of the tailed log will show up, but the matches will be highlighted.
ack is at http://beyondgrep.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With