📄 tally.unwanted
字号:
#!/bin/sh## $Revision: 1.4 $## Tally/update the unwanted newsgroup log## Read an innd log on stdin, scan it for articles that were unwanted## because they newsgroups were not in our active file. Update unwanted.log## to have the new count of unwanted groups, and how often they were used.## =()<. @<_PATH_SHELLVARS>@>()=. /var/spool/news/data/innshellvarsPROGNAME=unwantedLOCK=${LOCKS}/LOCK.${PROGNAME}LOG=${MOST_LOGS}/unwanted.logUNWANTED_NEW=${LOG}.newUNWANTED_OLD=${LOG}.old## Lock.shlock -f ${LOCK} -p $$ || { echo "$0: cannot lock $LOCK" 1>&2 exit 2}## Prepare the files.if [ ! -f ${LOG} ]; then touch ${LOG} chmod 0660 ${LOG}firm -f ${UNWANTED_NEW} ${UNWANTED_OLD}ln ${LOG} ${UNWANTED_OLD}touch ${UNWANTED_NEW}chmod 0660 ${UNWANTED_NEW}## Grab the data.${AWK} '$4 == "-" && $7 == "437" && $8 == "Unwanted" { print }' \ | ${SED} 's/.*"\(.*\)".*/\1/' \ | sort \ | uniq -c \ | cat - ${LOG} \ | ${AWK} 'BEGIN { unwanted[0]=0; } { unwanted[$2] += $1; } END { for (group in unwanted) { if (group != 0) { print unwanted[group], group; } } }' \ | sort -n -r >${UNWANTED_NEW}mv -f ${UNWANTED_NEW} ${LOG}## All done.rm -f ${LOCK}exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -