Thursday, February 7, 2013

bulk add users to moira lists

I always forget how to do this, but if you ever need to populate an email list at MIT, you can do it through blanche.
If you want to add a long list of names to a list, you can put them all in a text file and do 'blanche listname -al filename', or if you want a list to contain only the names in a text file, you can type 'blanche listname -f filename' and the appropriate members will be both added and removed
Thus, at a terminal, I would go

narw@ubuntu:~$ ssh [remote login to athena]
nouyang@dr-wily:~$ vi 2.007ua [make a file with a list of athena usernames. it will accept the but it's happier without. You can do this with gedit if you want.]
nouyang@dr-wily:~$ blanche 2.007-2013uas -al 2.007ua

voila! done. If you want to double-check they've been added, just do

nouyang@dr-wily:~$ blanche 2.007-2013uas

and everyone should pop up. or check online at


Additionally, if you're copy-pasting a lot of stuff (e.g. from stellar) and only want the lines containing emails, you can do
and that keeps only the lines with @ signs. Blanche doesn't much care about whitespace so don't worry about it.

Nancy Ouyang
    Office: EAST CAMPUS # H208 
    Phone: 2256223  

gets reduced to

and blanche -al just says

Warning: "" converted to "nouyang" because it is a local name.

and works perfectly fine.