Re: Simple Unix utility?
On 5 Dec 1997, Jim Pick wrote:
> One task I do commonly is monitor my system log files using
> 'tail -f'.
> I was wondering if there was a commonly used method for doing the
> same thing, but filtering it at the same time.
> For example, I like to view the logs on the LinuxHQ website as they are
> being generated, but I don't care about gif's and jpeg's, or accesses
> from my domain. So I end up using something like this (in a wide xterm):
> $ watch -n 10 'tail -100 /opt/linuxhq/livesite/var/log/access.log |
> grep -v "gif|jpg|jimpick\.com" | tail -20 | cut -c1-175'
> It works - but it obviously isn't the most efficient way of doing this.
> I was wondering if there was a Unix utility I may have overlooked
> that does the same sort of thing. I know I could probably write a
> Perl script to do the same thing - but it seems like a general enough
> problem that there is probably something that handles it already.
Umm, you had the right idea when using tail -f. Try
tail -f <file> | grep <pattern>
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to email@example.com .