moodle2passwd
The snippet can be accessed without any authentication.
Authored by
guillaum.chanel
Convert a moodle participant list in CSV format to a file in the approaximate passwd format needed by the command newusers
moodle2passwd.sh 479 B
tail -n +2 "$1" | cut -d, -f1-2 | tr -d '"' | tr '[A-Z]' '[a-z]' | iconv -t ASCII//TRANSLIT | sed -e 's/\( \).*\(,\)/\2/' | sed -e 's/ .*//' | tr ',' '.' | sed -e 's/\(.*\)/\1:\1:::temporary student account:\/home\/\1:\/bin\/bash/
# cut header line | get first and last name only | remove csv quotes | put to lower case | remove accents | keep only the first surname if many | keep only the first lastname if many | put a dot between first and last name | create the passwd file
Please register or sign in to comment