views:

67

answers:

2

I am trying to debug some errors in a live Merb app. There are a lot of lined of error code running by, but I jut need to see the first one. I can use grep to select these lines and print them but it closes as soon as it reached the end of the file.

What I would like to do is use grep like the shift-F mode in less where it will keep the file open and report new matching line as they are written to the log.

- or -

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

A: 

Can't you do this with watch and tail?

watch -n 30 "grep 'dev.log' '^ERROR:' | tail -n 30"
Paul Betts
+4  A: 

try this

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

the -f option to tail tells it to wait for more data when it hits EOF.

Michael Kohne