Re: Removing perl traces from src/etc/periodic
Brian Somers <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.audit |
|---|---|
| Message-ID | <[email protected]> |
> 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 | [email protected]
> | [email protected]
> http://people.freebsd.org/~cjc/ | [email protected]
--
Brian <[email protected]> <[email protected]>
<http://www.Awfulhak.org> <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour ! <brian@[uk.]OpenBSD.org>
To Unsubscribe: send mail to [email protected]
with "unsubscribe freebsd-audit" in the body of the message