Using cut in continuous follow (tail -F)
I want to follow a file, filter for the word FOOBAR and only display certain fields of it by delimiting with a space.
Is this possible? This works ok, but I just want the 1st, 2nd and 5th field Code:
sudo tail -F /var/log/syslog | grep --color FOOBAR Code:
sudo tail -F /var/log/syslog | grep --color FOOBAR | cut -d' ' -f 1,2,5 Code:
sudo tail /var/log/syslog | grep --color FOOBAR | cut -d' ' -f 1,2,5 |
Try using the "--line-buffered" option of grep: https://www.gnu.org/software/grep/ma...#Other-Options
|
That solved it. Thanks
Code:
--line-buffered Code:
sudo tail -f /var/log/syslog | grep --line-buffered --color FOOBAR | cut -d' ' -f 1,2,3,7,11 |
All times are GMT -5. The time now is 12:07 AM. |