Find Missing Records

Dec 16, 2013
1 min read
Jun 30, 2023 16:33 EEST

Sync Users with plain files

To find users which are not in a second list I use mysql as a tool.

To get the users in a group:

pw showgroup freebus >users.txt

Now edit the file and remove the group name and the GID.

Load the file with:

create database users;
use users;
create table users (users varchar(100));
load data infile '/root/users.txt' into table users lines terminated by ',';

Maybe you have to update the last entry.

Create the second list with:

svn -q log | grep '^r' | cut -d ' ' -f 3 | sort | uniq >commiters.txt

Take the comma seperated list of the second file:

create table commiters (users varchar(100));
load data infile '/root/commiters.txt' into table commiters lines terminated by '\n';

Get a list of all users which are not in both lists:

select users.users,commiters.users from users left outer join commiters on users.users=commiters.users where commiters.users IS NULL;