... ciao:
: on "12-24-2006" "Mário Gamito" writ:
: Change the second field to the correspondent md5 hash.
i have no idea how to do that, so it's left to the reader.
===== start code =====
#!/bin/sh
#########################################
# 4 fields maximun, 2 mandatory #
#########################################
# 1 user
# 2 password
# 3 if exist , can be 'name' or 'email'
# 4 if exist is 'email'
# files: edit to taste
SRC="source"
DST="destination"
# let's read it
cat $SRC | \
while read USER PASSWORD REMAINDER ; do
# process user
echo -n $USER: >> $DST
# YOUR password md5 hash code goes bere
MD5="*******"
echo -n "$MD5:" >> $DST
# test for name or email
if [ "$REMAINDER" = "" ]
then echo "NO_NAME:foo@xxxxxxx" >> $DST
continue
# snag email and/or name
else NAME=""
MAIL=""
for T in `echo "$REMAINDER"`
do if [ `echo "$T" | fgrep -v "@"` ]
then NAME="$NAME $T" # <---- adds space
else MAIL="$T"
fi
done
# finish up
if [ "$NAME" = "" ]
then NAME="NO_NAME"
fi
NAME=`echo "$NAME" | cut -d " " -f 2-` # <---- consumes it
if [ "$MAIL" != "" ]
then echo "$NAME:$MAIL" >> $DST
else echo "$NAME:foo@xxxxxxx" >> $DST
fi
fi
done
exit
===== end code =====
--
... i'm a man, but i can change,
if i have to , i guess ...
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Newbie]
[Audio]
[Hams]
[Kernel Newbies]
[Util Linux NG]
[Security]
[Netfilter]
[Bugtraq]
[Photo]
[Yosemite Photos]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Linux Device Drivers]
[Samba]
[Video 4 Linux]
[Git]
[Linux Resources]
[Fedora Users]