HPUX to SLES Linux user account converter script

I wrote the following quick shellscript to migrate a load of user accounts from HPUX to Linux.
At the moment it doesnt do anything with existing home directories,as I will use a backup and restore process to manage this.
For me, the main focus was to have the users created in the same order as they were originally, and for them to retain the same password hashes without needing to do a mass reset.
The script below uses a copy of the HPUX /etc/passwd – which I scp’d to the Linux server that I wanted to replicate the users on to. I renamed it passwd.lst
I then edited and removed the root user entry from the HPUX passwd.lst and copied the rest of it to the Linux /etc/shadow.
I then tested this by logging in with the HPUX account credentials to the SLES Linux server.

#Matt Palmer 27 Oct 2011
#this script parses the current HPUX passwd list to creat the adduser statements
#another script will then be run to create a new /etc/shadow including the
#HPUX hashes

ARRAY=(`cat passwd.lst|wc -l`)
for (( i=0;i<$ELEMENTS;i++)); do
cut -d : -f 1,5 <passwd.lst > /passwd.stg1
sed ‘s/^/useradd -m /g’ /passwd.stg1 > passwd.stg2
sed ‘s/:/ -c “/g’ passwd.stg2 > passwd.stg1
sed ‘s/$/”/g’ passwd.stg1 > passwd.final
sh passwd.final

Matt Palmer 10 Nov 2011