#!/bin/bash
#
rm ./logins.csv
while read line
do
	touch ./temptp4.txt
	file='./temptp4.txt'
	echo $line > $file
	surname=$(cut -d "," -f 1 $file)
	name=$(cut -d "," -f 2 $file)
	group=$(cut -d "," -f 5 $file)
	initials=$(cut -c 1 $file)
	id=$(echo $initials$name | tr [:upper:] [:lower:])
	passwd=$(echo $RANDOM | md5sum | head -c 8)
	echo $id","$passwd","$surname","$name","$group>> logins.csv
	rm ./temptp4.txt
done < ./Users.csv
