[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: log reading while updating



roberto:
>
> a runnig program logs its output to a file and i'd like to read this
> log file "while" it is being written and updated by the program, and
> 
> possibly searching in it for patterns and so on

When you want to search for specific patterns, you can either

$ tail -f /var/log/syslog | grep foobar

That way you only see lines containing your pattern.

Or you use "less /var/log/syslog", then search ('/') for your pattern
and then press 'F' ("Follow changes") which gives you a tail-like
display of the file. The difference is that less will highlight matches
but still display all the rest.

BTW, less has some really handy functions, like '-S' to toggle line
wrapping and '-N' to toggle the display of line numbers. Just press 'h'
to get an overview. And it can display colors, which grep can do, too.

J.
-- 
I count my partner's eyelashes.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: