Scripting gurus

I'm on a site that is using tripwire for security checks, and has flagged insufficent logging in xinetd scripts (this isn't a question of the pros and cons of using xinetd).

I cobbled together the script below to comment out "log_on" rules insert a comment and new values.

With xinetd "stuff" needs to be between { and }, does anyone have any suggestions to make the script smarter?

Cheers!

Code:
#!/bin/bash
XINETD_PATH="/etc/xinetd.d/"
PERL=$(which perl)
AWK=$(which awk)

for f in $(ls -1 $XINETD_PATH); do
  F=$XINETD_PATH$f
  $PERL -i -pe "s/(\s*log_on_(success|failure)\s.*)/#\1/g" $F
  $AWK 'begin {done=0;} {
        print $0;
        if (!done && $1=="{") {
          print "#";
          printf "#  %s  TripWire 10.2.0.13 Added additional logging\n", d;
          print "#";
          print "log_on_success = HOST PID USERID EXIT";
          print "log_on_failure = HOST USERID";
          done=1;
        }
      }' "d=$(date +%d-%b-%Y)" $F > $F.tmp
  mv $F.tmp $F
done