From owner-freebsd-questions@FreeBSD.ORG Fri Jun 20 08:49:30 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF7AF37B401 for ; Fri, 20 Jun 2003 08:49:30 -0700 (PDT) Received: from wonkity.com (wonkity.com [65.173.111.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id B435343F75 for ; Fri, 20 Jun 2003 08:49:29 -0700 (PDT) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.12.9/8.12.9) with ESMTP id h5KFnTXk012999; Fri, 20 Jun 2003 09:49:29 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.12.9/8.12.9/Submit) with ESMTP id h5KFnS7o012996; Fri, 20 Jun 2003 09:49:28 -0600 (MDT) Date: Fri, 20 Jun 2003 09:49:28 -0600 (MDT) From: Warren Block To: Matthew Seaman In-Reply-To: <20030620153457.GA2304@happy-idiot-talk.infracaninophile.co.uk> Message-ID: <20030620094405.P12980@wonkity.com> References: <20030620130049.63710.qmail@web10002.mail.yahoo.com> <20030620134326.GA615@happy-idiot-talk.infracaninophile.co.uk> <20030620153457.GA2304@happy-idiot-talk.infracaninophile.co.uk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Ronnie Clark cc: FreeBSD Questions Subject: Re: IPFW Log question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2003 15:49:31 -0000 On Fri, 20 Jun 2003, Matthew Seaman wrote: > That's not quite the same thing. You're just taking out the lines > that match /last message repeated \d+ times/ (and constructing a > backreference to \d+ that you never use): > > Jun 20 16:26:02 example /kernel: ipfw: 800 Deny TCP 12.34.56.78:1234 21.43.65.87:4321 out via de0 > Jun 20 16:26:27 example last message repeated 2 times > > becomes: > > Jun 20 16:26:02 example /kernel: ipfw: 800 Deny TCP 12.34.56.78:1234 21.43.65.87:4321 out via de0 > > whereas I'm replacing that line with the correct number of repeats of > the original line, Ah, I didn't see that you were expanding those lines. You're right about the useless backreference. And then right after posting, I realized that it could be even smaller and--arguably--clearer: #!/usr/bin/perl -w while (<>) { print unless /last message repeated \d+ times/; } -Warren Block * Rapid City, South Dakota USA