title: Bulk Assign Multiple Users to Multiple Groups
body: <p>I have 2 text files, users.txt with a list of 1000 users and groups.txt with a list of 50 groups. I want to run a command that adds 30 users to each group (ex: users 1-30 to group 1, users 31-60 to group 2, etc.). What would be the most practical way of doing this? </p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>for i in `cat users.txt` ; do useradd $i; echo Pass$i | passwd $i -- stdin; done
  for i in `cat groups.txt` ; do groupadd $i; done
  </code></pre>