From owner-freebsd-questions@FreeBSD.ORG Thu Apr 23 06:27:55 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F041D1065799 for ; Thu, 23 Apr 2009 06:27:55 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id ADB598FC16 for ; Thu, 23 Apr 2009 06:27:55 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-196-27-202.dynamic.qsc.de [92.196.27.202]) by mx01.qsc.de (Postfix) with ESMTP id 1694AB613; Thu, 23 Apr 2009 08:27:54 +0200 (CEST) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id n3N6RsVx001543; Thu, 23 Apr 2009 08:27:54 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Thu, 23 Apr 2009 08:27:54 +0200 From: Polytropon To: "=?UTF-8?Q?Evuraan::=E0=B4=8F=E0=B4=B5=E0=B5=82=E0=B4=B0=E0=B4=BE?= =?UTF-8?Q?=E0=B4=A8=E0=B5=8D=E2=80=8D?=" Message-Id: <20090423082754.a291541b.freebsd@edvax.de> In-Reply-To: <6fbcd0710904221238r1cb63d41qaa331beb683ffa95@mail.gmail.com> References: <6fbcd0710904221238r1cb63d41qaa331beb683ffa95@mail.gmail.com> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: freebsd-questions@freebsd.org Subject: Re: awk question (actively tail a file & notify when expression is found) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Apr 2009 06:27:56 -0000 On Wed, 22 Apr 2009 12:38:47 -0700, Evuraan::ഏവൂരാന്‍ wrote: > but this below, does not work > > tail -f /var/log/apache2/access.log |awk ' /192.168.1.100/ { print > $0 | "mail me@email.address "}' I would suggest to keep the system() approach: tail -f /var/log/apache2/access.log | awk '/192.168.1.100/ { system(sprintf("echo %s | mail me@email.address", $0)); }' > Any pointers would be much appreciated. It should work, but I'm sure someonle else will soon show you some more elegant way. :-) -- Polytropon >From Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...