Compare two arrays in sh or compare two fields

I want a soultion to compare two arrays in sh with an easy way.I want a solution to synchrose users between different AIX servers where no NIS is available. All users are meant to be same on all 10 servers. So the approach is to consider first server as master user repository and whatever the users are created on it has to extract in a format and use a tempate file for creating missing users on other servers by comparing values in template file with its /etc/passwd file.

Hence my template file creates on following command

`cat /etc/passwd | awk -F ':' '{printf("%-15s %-62s %-5s %-5s \n",$1,$5,$4,$6)}'` > allusers.txt

Which will have all the fields to create users.At the same time i need to remove the service accounts like root dameon etc from allusers.txt. So service accounts are already known and assigned into an variable.

SERVICE_ACCOUNTS="root daemon bin sys adm uucp nobody lpd lp invscout snapp ipsec nuucp sshd wasadmin db2inst1 dasusr1 db2fenc1 db2inst2 db2fenc2 vobadm gpausr"

Need to extract userlogin from allusers.txt by comparing SERVICE_ACCOUNTS.

createProjectUserTemplate()
{

#Find all users, Construct list and then compare with defined service account users list
`cat /etc/passwd | awk -F ':' '{printf("%-15s %-62s %-5s %-5s \n",$1,$5,$4,$6)}'` > allusers.txt
set -A serviceAccountsList $SERVICE_ACCOUNTS
#Construct user login from allusers
allUserLogins=`cut -f1 -d ' ' allusers.txt`
set -A totUserLoginsList $totUserLogins
#Differentiate two lists and find and construct Project user list and put into ProjectUserTemplate.txt file along with rest of the field
Need s suitable easy way of comaparing.
}

Can anyone help me to compare these values in an easy way as i am new to shell scripting. All i know is that we have to use sh or ksh becasue bash is not install on AIX by default.

I have seen another question almost similar to me on the link
Comparing Arrays? . But the solution given there is not working me when i cut userlogin field and then assigning to variable.

i.e. the problem in tha tway is

a1="root daemon bin sys adm uucp nobody lpd lp invscout snapp ipsec nuucp sshd wasadmin db2inst1 dasusr1 db2fenc1 db2inst2 db2fenc2 vobadm gpausr"
a2=`cut -f1 -d ' ' allusers.txt`

Then

a3=$(printf "$a1\n$a2"|awk '{for(i=1;i<=NF;i++)if(NR==1)a[$i]=i;else if(!($i in a))print $i}')

does not give me the difference as seems to be problem with cut. If there is a solution to this then aslo i will be grateful.

Thanks in advance,
Rijesh.