Date: Tue, 13 Jul 1999 11:56:53 -0500 From: Lucas Bergman <iceberg@pobox.com> To: "Derek Jewett" <djewett@snowcrest.net> Cc: freebsd-questions@freebsd.org Subject: Re: Adding users... Message-ID: <199907131654.LAA13913@eeyore.cc.uic.edu> In-Reply-To: Your message of "Tue, 13 Jul 1999 08:58:06 PDT." <000801becd48$7fa40e70$5515a8c0@co.shasta.ca.us>
next in thread | previous in thread | raw e-mail | index | archive | help
> Running 3.1-R, I want to import users from a comma delimited file > (exported from a large Windows NT domain) into my passwd database... > Is there a utility for this type of stuff... thanks! i don't know of any utility _per se_, but it can be done _very_ quickly with Awk and a shell script. for example, if your file contains just 'username,real name' on each line, then use the script: ---------- #!/bin/sh while read line do fields=`echo $line | awk 'BEGIN { FS = "," } { print $1, $2 }'` username=`echo $fields | (read username realname; echo $username)` realname=`echo $fields | (read username realname; echo $realname)` /usr/sbin/pw useradd $username -c "$realname" done ---------- call it, say, 'add_nt_users.sh'. then run $ ./add_nt_users.sh <nt_user_data and you're on your way. see awk(1) and sh(1) for more details. you can obviously tailor the script to add handling for lots of fields... Lucas -- S. Lucas Bergman University of Illinois at Chicago Mathematics Department PGP Public Key (0xC0C73619): finger -l lucas@math.uic.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907131654.LAA13913>