📄 tally.control
字号:
#!/bin/sh## $Revision: 1.5 $## Tally/update the newgroup/rmgroup control log.## Merge in a log that contains newgroup/rmgroup control messages so that## the "control.log" file is updated to contain the new counts of how## often each group has been newgroup'd or rmgroup'd. This is run by## scanlogs, which prepares this from the control-message handlers if## control.ctl specifies logging.## =()<. @<_PATH_SHELLVARS>@>()=. /var/spool/news/data/innshellvarsCONTROL=${MOST_LOGS}/control.logCONTROL_NEW=${CONTROL}.newCONTROL_OLD=${CONTROL}.oldPROGNAME=`basename $0`LOCK=${LOCKS}/LOCK.${PROGNAME}## Lock.trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15shlock -f ${LOCK} -p $$ || { echo "$0: cannot lock ${LOCK}" 1>&2 exit 1}## Prepare the files.if [ ! -f ${CONTROL} ]; then touch ${CONTROL} chmod 0660 ${CONTROL}firm -f ${CONTROL_NEW} ${CONTROL_OLD}ln ${CONTROL} ${CONTROL_OLD}touch ${CONTROL_NEW}chmod 0660 ${CONTROL_NEW}## Grab the data.${SED} -n -e 's/[ ][ ]*/ /g' -e 's/^ \(Control:.*\)$/1 \1/p' \ | cat - ${CONTROL} \ | ${SED} -e 's/ /#/g' -e 's/\([0-9][0-9]*\)#\(.*\)/\1 \2/' \ | ${AWK} 'BEGIN { ctl[0]=0; } { ctl[$2] += $1; } END { for (line in ctl) { if (line != 0) { print ctl[line], line; } } }' \ | tr '#' ' ' \ | sort -n -r >${CONTROL_NEW}mv -f ${CONTROL_NEW} ${CONTROL}## All done.rm -f ${LOCK}exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -