From owner-freebsd-audit Fri May 31 1:44:47 2002 Delivered-To: freebsd-audit@freebsd.org Received: from Awfulhak.org (gw.Awfulhak.org [217.204.245.18]) by hub.freebsd.org (Postfix) with ESMTP id 7D17037B406; Fri, 31 May 2002 01:44:26 -0700 (PDT) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [IPv6:fec0::1:12]) by Awfulhak.org (8.12.3/8.12.3) with ESMTP id g4V8iO7e094922; Fri, 31 May 2002 09:44:24 +0100 (BST) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.12.3/8.12.3) with ESMTP id g4V8iIEU024730; Fri, 31 May 2002 09:44:18 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200205310844.g4V8iIEU024730@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: cjclark@alum.mit.edu Cc: Giorgos Keramidas , freebsd-audit@freebsd.org, Brian Somers , Doug Barton , Gregory Neil Shapiro , Robert Watson , brian@Awfulhak.org Subject: Re: Removing perl traces from src/etc/periodic In-Reply-To: Message from "Crist J. Clark" of "Wed, 29 May 2002 11:29:22 PDT." <20020529112922.A12700@blossom.cjclark.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 31 May 2002 09:44:18 +0100 From: Brian Somers Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > On Wed, May 29, 2002 at 06:20:10PM +0300, Giorgos Keramidas wrote: > > [snip] > > > Index: etc/periodic/security/550.ipfwlimit > > =================================================================== > > RCS file: /home/ncvs/src/etc/periodic/security/550.ipfwlimit,v > > retrieving revision 1.3 > > diff -u -r1.3 550.ipfwlimit > > --- etc/periodic/security/550.ipfwlimit 17 May 2002 11:34:12 -0000 1.3 > > +++ etc/periodic/security/550.ipfwlimit 28 May 2002 20:57:21 -0000 > > @@ -45,8 +45,10 @@ > > [Yy][Ee][Ss]) > > IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null` > > if [ $? -eq 0 ] && [ "${IPFW_LOG_LIMIT}" -ne 0 ]; then > > - ipfw -a l | grep " log " | perl -n -e \ > > - '/^\d+\s+(\d+)/; print if ($1 >= '$IPFW_LOG_LIMIT')' > ${TMP} > > + ipfw -a l | grep " log " | \ > > + grep '^[[:digit:]]\+[[:space:]]\+[[:digit:]]\+' | \ > > + awk -v limit="$IPFW_LOG_LIMIT" \ > > + '{if ($2 > limit) {print $0}}' > ${TMP} > > + ipfw -a l | > + awk -v limit="$IPFW_LOG_LIMIT" \ > + '/ log / && /^[[:digit:]]+[[:space:]]+[[:digit:]]+/ { \ > + if ($2 > limit) {print;} \ > + }' > ${TMP} > > For whatever reason, chaining grep(1)s in front of an awk(1) always > bothers me. It's easy enough to do with one awk(1). Agreed. Ditto for sed :) > -- > Crist J. Clark | cjclark@alum.mit.edu > | cjclark@jhu.edu > http://people.freebsd.org/~cjc/ | cjc@freebsd.org -- Brian Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message