# configuration file for newsyslog
# $FreeBSD: /repoman/r/ncvs/src/etc/newsyslog.conf,v 1.50 2005/03/02 00:40:55 brooks Exp $
#
# Entries which do not specify the '/pid_file' field will cause the
# syslogd process to be signalled when that log file is rotated. This
# action is only appropriate for log files which are written to by the
# syslogd process (ie, files listed in /etc/syslog.conf). If there
# is no process which needs to be signalled when a given log file is
# rotated, then the entry for that file should include the 'N' flag.
#
# The 'flags' field is one or more of the letters: BCGJNUWZ or a '-'.
#
# Note: some sites will want to select more restrictive protections than the
# defaults. In particular, it may be desirable to switch many of the 644
# entries to 640 or 600. For example, some sites will consider the
# contents of maillog, messages, and lpd-errs to be confidential. In the
# future, these defaults may change to more conservative ones.
#
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/appfirewall.log 640 5 1000 * J
/var/log/ftp.log 640 5 1000 * J
/var/log/hwmond.log 640 5 1000 * J
/var/log/install.log 640 5 1000 * J
/var/log/ipfw.log 640 5 1000 * J
/var/log/lookupd.log 640 5 1000 * J
/var/log/lpr.log 640 5 1000 * J
/var/log/mail.log 640 5 1000 * J
/var/log/ppp.log 640 5 1000 * J
/var/log/secure.log 640 5 1000 * J
/var/log/system.log 640 7 * @T00 J
/var/log/wtmp 644 3 * @01T05 B
I want to change the third, fourth, and fifth fields, so I wrote:
# configuration file * $W1
# $FreeBSD: /repoman/r/ncvs/src/etc/newsyslog.conf,v * $W1 00:40:55 brooks Exp $
# * $W1
# Entries which * $W1 specify the '/pid_file' field will cause the
# syslogd process * $W1 signalled when that log file is rotated. This
# action is * $W1 for log files which are written to by the
# syslogd process * $W1 listed in /etc/syslog.conf). If there
# is no * $W1 needs to be signalled when a given log file is
# rotated, then * $W1 for that file should include the 'N' flag.
# * $W1
# The 'flags' * $W1 one or more of the letters: BCGJNUWZ or a '-'.
# * $W1
# Note: some * $W1 want to select more restrictive protections than the
# defaults. In * $W1 may be desirable to switch many of the 644
# entries to * $W1 600. For example, some sites will consider the
# contents of * $W1 and lpd-errs to be confidential. In the
# future, these * $W1 change to more conservative ones.
# * $W1
# logfilename [owner:group] * $W1 size when flags [/pid_file] [sig_num]
/var/log/appfirewall.log 640 13 * $W1 J
/var/log/ftp.log 640 13 * $W1 J
/var/log/hwmond.log 640 13 * $W1 J
/var/log/install.log 640 13 * $W1 J
/var/log/ipfw.log 640 13 * $W1 J
/var/log/lookupd.log 640 13 * $W1 J
/var/log/lpr.log 640 13 * $W1 J
/var/log/mail.log 640 13 * $W1 J
/var/log/ppp.log 640 13 * $W1 J
/var/log/secure.log 640 13 * $W1 J
/var/log/system.log 640 13 * $W1 J
/var/log/wtmp 644 13 * $W1 B
And I just realized it was acting on every line, not lines starting with a '/'
So, I now have two questions... one is, how do I preserve the original whitespace; two, how to I get multiple substitutions limited to those lines that match my pattern?