I want to tail my development.log file, but i only want to show the lines that have the word "ERROR" in. How can i do this?? Doing this : tail -f development.log | grep "ERROR" will filter the log file, but it will not constantly update itself. i.e. newly added lines to the log file that contain "ERROR" are not displayed. Does anyone know how to do this? Thanks Chris -- Posted via http://www.ruby-forum.com/.
>>>>> "Chris" == Chris <evilgeenius@gmail.com> writes:> Doing this : > tail -f development.log | grep "ERROR" > will filter the log file, but it will not constantly update itself.Oh, it does update. It just doesn''t show the results to you as often as you''d like. The problem is that grep will use its normal I/O buffers, which are suited for reading from and writing to files. If you''re using GNU or FreeBSD grep, try giving the --line-buffered option to it. -- Calle Dybedahl <calle@cyberpomo.com> http://www.livejournal.com/users/cdybedahl/ Please pay no attention to the panda in the fridge.
Yeah that works, thanks Chris -- Posted via http://www.ruby-forum.com/.
On Jun 5, 2006, at 6:47 AM, Calle Dybedahl wrote:>>>>>> "Chris" == Chris <evilgeenius@gmail.com> writes: > >> Doing this : >> tail -f development.log | grep "ERROR" >> will filter the log file, but it will not constantly update itself. > > Oh, it does update. It just doesn''t show the results to you as often > as you''d like. The problem is that grep will use its normal I/O > buffers, which are suited for reading from and writing to files. If > you''re using GNU or FreeBSD grep, try giving the --line-buffered > option to it. > -- > Calle Dybedahl <calle@cyberpomo.com> > http://www.livejournal.com/users/cdybedahl/ > Please pay no attention to the panda in the fridge. > _______________________________________________If you have ''less'', you can do: less -p''ERROR'' development.log and use the ''F'' command to follow the end like ''tail -f'' does. This has the added benefit of being able to break out of the ''Waiting...'' and peruse the log for a bit before continuing with another ''F''. -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com +1 513-295-4739
> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Chris > Sent: Monday, June 05, 2006 5:36 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] Using grep with tail. Unix challenge! > > > I want to tail my development.log file, but i only want to > show the lines that have the word "ERROR" in. How can i do this?? > > Doing this : > tail -f development.log | grep "ERROR" > will filter the log file, but it will not constantly update > itself. i.e. > newly added lines to the log file that contain "ERROR" are > not displayed. > > Does anyone know how to do this?See file-tail, on the RAA. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.