Skip to Content.
Sympa Menu

en - Re: [sympa-users] Easiest way to add a long list of users to a new list?

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Jaromir Hanus <address@concealed>
  • To: <address@concealed>
  • Subject: Re: [sympa-users] Easiest way to add a long list of users to a new list?
  • Date: Wed, 28 Aug 2002 09:27:47 +0200 (METDST)

Hello Michelle,

> I'll be migrating a number of lists to sympa, and I also have a list
> I need to set up right now - I have a text file with a long list of

it seems to be the common problem for all who replace their existing
listproc system with sympa. Same with us - we're switching from A.
Kotsikonas listprocesor system. Subscribers are held here in the file
containing subscriber entries in format:

address@concealed NOACK 912361234 NO Jaromir Hanus

We use simple script named convk2s that reads this file, outputs script
file for postgres, (that we use for sympa), then we run psql to store data
in the database.

Listing of convk2s:

#-----------------------------------------------------------------------
#!/bin/sh

# convk2s

if [ $# = 0 ] ; then
echo "Enter list name"
exit 1
fi

inf="subscribers.$1"
outf="subscribers.$1.pg"
datum="`date +%d.%m.%y`"

echo "\\\connect sympa" > $outf
echo "begin transaction;" >> $outf
echo "delete from subscriber_table where list_subscriber like '$1';" >> $outf

reception="mail"
concea="noconceal"

cat $inf | while read i
do
email=`echo $i| cut -d" " -f1 | tr -A '[:upper:]' '[:lower:]'`
name=`echo $i| cut -d" " -f5-`
recept=`echo $i| cut -d" " -f2`
conce=`echo $i| cut -d" " -f4`
case "$recept" in
ACK)
reception="mail"
;;
NOACK)
reception="mail"
;;
POSTPONE)
reception="nomail"
;;
DIGEST)
reception="digest"
;;
esac
case "$conce" in
NO) concea="noconceal";;
YES) concea="conceal";;
esac
echo "INSERT INTO subscriber_table (list_subscriber,user_subscriber,\
date_subscriber,update_subscriber,visibility_subscriber,\
reception_subscriber,comment_subscriber) \
VALUES ('$1','$email','$datum','$datum','$concea','$reception','$name');" \
>> $outf
echo $name $email
done

echo "end transaction;" >> $outf

#-------------------------------------------------------------------------

Procedure:

1) Place the above script and the old subscriber file named
subscribers.listx in a working directory. listx is name of the list.
Change to this directory.

2) ./convk2s listx
This creates new file subscribers.listx.pg

3) /some/place/bin/psql < subscribers.listx.pg . We run it as postgres
user.

Hope it can help you a bit.

Regards

Ing. Jaromir Hanus
UTIA/AVCR
Pod vodarenskou vezi 4
182 08 Praha 8
tel.: +420 2 6605 2364
e-mail:address@concealed




Archive powered by MHonArc 2.6.19+.

Top of Page