Date: Wed, 29 May 2002 11:29:22 -0700 From: "Crist J. Clark" <crist.clark@attbi.com> To: Giorgos Keramidas <keramida@freebsd.org> Cc: freebsd-audit@freebsd.org, Brian Somers <brian@freebsd.org>, Doug Barton <dougb@freebsd.org>, Gregory Neil Shapiro <gshapiro@freebsd.org>, Robert Watson <rwatson@freebsd.org> Subject: Re: Removing perl traces from src/etc/periodic Message-ID: <20020529112922.A12700@blossom.cjclark.org> In-Reply-To: <20020529152010.GA13893@hades.hell.gr>; from keramida@freebsd.org on Wed, May 29, 2002 at 06:20:10PM %2B0300 References: <20020529152010.GA13893@hades.hell.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
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).
--
Crist J. Clark | cjclark@alum.mit.edu
| cjclark@jhu.edu
http://people.freebsd.org/~cjc/ | cjc@freebsd.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020529112922.A12700>
