#!/bin/bash # generate SQL to move people from newman to mail1. takes usernames from # filenames in the ok/ directory since these are assumed to have completed # successfully. WORKDIR=/data/conversion cd $WORKDIR echo "BEGIN;" find ok -mindepth 1 | cut -d'/' -f2 | while read login; do echo "UPDATE users SET mail=split_part(mail, '@', 1) || '@mail1.yumaed.org' WHERE uname='$login';" done echo "COMMIT;"