How to filter by specified character in Linux tail command
You often want to look at logs with the tail -f command.
If you have a large number of logs, have you ever had a problem with the tail command because you are not sure if the logs you are looking at are the target logs or not?
tail -f a.log | grep hoge
If you want to filter by ‘hoge’, you can use the following command.
If you want to filter by ‘hoge’, you can use the following command, but it does not display the log in real time like the tail command.
grep 'hoge' a.log
grep –line-buffered
You can filter the tail command by grep --line-buffered hoge
.
tail -100f a.log | grep --line-buffered hoge
コメント