How do I get grep so that the file / pipe opens?

I am trying to debug some errors in a real Merb application. There are many aligned error codes, but I need to see the first one. I can use grepto select these lines and print them, but it closes as soon as it reaches the end of the file.

I would like to use grep as the mode shift-Fin less, where it will keep the file open and report a new line of correspondence as they are written to the log.

- or -

Is there a way to do this directly with lessthat I don't know about?

+3
source share
2 answers

try it

tail -f dev.log | grep '^ERROR:'

-f , EOF.

+5

?

watch -n 30 "grep 'dev.log' '^ERROR:' | tail -n 30"
0

Source: https://habr.com/ru/post/1716620/


All Articles