From owner-freebsd-current@FreeBSD.ORG Wed Aug 4 14:26:35 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1F4D106576D; Wed, 4 Aug 2010 14:26:35 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 75C6E8FC16; Wed, 4 Aug 2010 14:26:35 +0000 (UTC) Received: by qwg5 with SMTP id 5so1253518qwg.13 for ; Wed, 04 Aug 2010 07:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Vmz8O5tDVbpKHNZIIg27bw9d/0GE1TtXKiyumes2imI=; b=ekZKUjlJtOPxGm96Dcsz9r4mAWM7t8SBoEUtrVXgo7oD3I7dz/bn1+MP+FSGe9WSuF nHdGDj09ervNUTIbEXKoZp+zVC6lGCzaYsAGkflejxfPwBhi0gZ+I0SXDsOMBuNfcNdR SXtehjZVRP4CiqzYWpnafEn1L9FcV+eiQ78Fs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=lSyYfx7bAjFEamNlB9lhbGLz98iaTo1RQ7xkmakgPdF90ZqKITWT/25pEEs4TCS5yK 1Au7AuGXtl3U9Wu7qIso/GZECGzLPmulv5kqUH6PXnsfVq7RJU5zEmXnBsm8vTHokgZI dFUQCMXqUaQsVZctYldPqmZhfcayZdrY5WlUM= Received: by 10.224.28.203 with SMTP id n11mr3876667qac.71.1280931994133; Wed, 04 Aug 2010 07:26:34 -0700 (PDT) Received: from centel.dataix.local (adsl-99-19-46-227.dsl.klmzmi.sbcglobal.net [99.19.46.227]) by mx.google.com with ESMTPS id t1sm2987547qcs.45.2010.08.04.07.26.31 (version=SSLv3 cipher=RC4-MD5); Wed, 04 Aug 2010 07:26:32 -0700 (PDT) Sender: "J. Hellenthal" Message-ID: <4C597896.70800@dataix.net> Date: Wed, 04 Aug 2010 10:26:30 -0400 From: jhell User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.7) Gecko/20100803 Thunderbird MIME-Version: 1.0 To: Gabor Kovesdan References: <86eiefhalp.wl%poyopoyo@puripuri.plala.or.jp> <4C585E44.5030608@FreeBSD.org> In-Reply-To: <4C585E44.5030608@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: poyopoyo@puripuri.plala.or.jp, current@freebsd.org Subject: Re: bsdgrep does not work with tail -f | grep combination X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Aug 2010 14:26:36 -0000 On 08/03/2010 14:21, Gabor Kovesdan wrote: > Em 2010.08.03. 19:25, poyopoyo@puripuri.plala.or.jp escreveu: >> Hi, >> >> It seems bsdgrep does not work when piped from tail -f. >> I'm running r210728. >> >> term0$ jot 10> /tmp/1 >> term0$ tail -f /tmp/1 | grep 0 >> [no output] >> >> otherterm$ jot 10>> /tmp/1 >> [no output to term0] >> >> ===== >> >> with GNU grep: >> >> term0$ tail -f /tmp/1 | gnugrep 0 >> 10 >> otherterm$ jot 10>> /tmp/1 >> [on term0] >> 10 >> 10 > I've checked on 8.0 and GNU grep doesn't output anything either for me. > If you use tail -f, you will enter more lines and end it with EOF, won't > you? And then BSD grep will process the input and print out matches. I > don't think it's bad behaviour in itself but if you can explain why you > think it's bad I'm willing to change it. > This is a common functionality gnu-grep. tail -f never exits and grep keeps grepping until it gets a EOF which is never hit unless you ^C. A good example for such a use is monitoring a all.log log while looking for non-exact situations. something like % tail -f all.log |egrep -v "(sendmail|sm-mta|cron)" which would remove all lines that contain sendmail sm-mta & cron from the output and continue to read output from tail -f until it is ^C. You can turn on your all.log through /etc/syslog.conf after creating the mode 600 file under /var/log for toying with. There is quite a few other cases but I don't think I need to mention them. I rely on this for continuous firewall log trolling. No offense but If the functionality exists in gnu-grep then the same functionality needs to exist in bsd-grep, ``period''. At least for the mean-time. Regards, -- jhell,v