You can use a bash script like this:
Code:
#!/bin/sh
FILE=$1
FS=":"
while read line
do
# store field 1
NAME=$(echo $line|cut -d$FS -f1)
# store field 2
PASSWORD=$(echo $line|cut -d$FS -f2)
/usr/local/apache/bin/htpasswd -b .htpasswd $NAME $PASSWORD
done < $FILE
Then you have to create a file (for example named filename) containing usernames and passwords (unencrypted) one per line and using the ":" character to separate username and password (as it is in .htpasswd) and run the scipt by: ./scriptname filename. Of course you have to change the path to htpasswd in the script accordingly and "chmod +x scriptname"