Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to run this command:

watch -n 1 tail -n 200 log/site_dev.log | grep Doctrine

But it does not run, because "I think" that the grep tries to run on the watch instead of the tail...

Is there a way to do something like

watch -n 1 (tail -n 200 log/site_dev.log | grep Doctrine)

Thanks a lot!

share|improve this question
add comment

2 Answers

up vote 29 down vote accepted

Surround the command with quotes

watch -n 1 'tail -n 200 log/site_dev.log | fgrep Doctrine'
share|improve this answer
    
Thanks for this!!! It works fine –  TomShreds May 12 '10 at 19:31
    
@TomShreds you should give some internet points to tonylo and accept this answer :) –  Malcolm Dec 4 '13 at 22:17
add comment

I might be wrong, but wouldn't this achieve the same thing more simply?

tail -f -n 200 log/site_dev.log | grep Doctrine
share|improve this answer
    
WONDERFUL! :) Thanks that is very good! –  TomShreds May 12 '10 at 20:18
    
I agree this may be more efficient as far as CPU is concerned, but in the context of the topic "Using watch with pipes" it doesn't use watch so isn't an answer. This might be a case of a poor example question as watch and pipes seem to appear frequently not in the context of tail. –  tudor Jan 20 at 0:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.