Skip to content

Instantly share code, notes, and snippets.

@3100
Created February 8, 2013 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3100/4736664 to your computer and use it in GitHub Desktop.
Save 3100/4736664 to your computer and use it in GitHub Desktop.
Remove spam accounts from your MoinMoin.
#!/bin/bash
WHITELIST=./whitelist
WHITEUSER_FILES=$(cat $WHITELIST)
for USER_FILE in `ls *.*.*`
do
PATTERN=''
for ITEM in $WHITEUSER_FILES
do
if [ ${#PATTERN} -gt 0 ] ; then
PATTERN="${PATTERN}|${ITEM}"
else
PATTERN=$ITEM
fi
done
EMAIL=`cat $USER_FILE | grep email= | sed -e s/email=//g`
SAFE=`echo ${EMAIL} | egrep "$PATTERN"`
if [ -n "$SAFE" ] ; then
continue
fi
if [ ${#EMAIL} -gt 0 ] ; then
NAME= echo `cat $USER_FILE | grep ^name= | sed -e s/name=//g`
#echo $EMAIL && rm -i $USER_FILE
echo $EMAIL && rm $USER_FILE
fi
done
exit 0
your_company.com
foo@some.org
bar@other.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment