From owner-freebsd-questions Tue Jul 13 9:58:27 1999 Delivered-To: freebsd-questions@freebsd.org Received: from eeyore.cc.uic.edu (EEYORE.CC.UIC.EDU [128.248.171.51]) by hub.freebsd.org (Postfix) with ESMTP id B18A414D78 for ; Tue, 13 Jul 1999 09:58:20 -0700 (PDT) (envelope-from lucas@comp04.prc.uic.edu) Received: from comp04.prc.uic.edu (COMP04.PRC.UIC.EDU [128.248.230.104]) by eeyore.cc.uic.edu (8.9.3/8.9.3) with SMTP id LAA13913 for ; Tue, 13 Jul 1999 11:54:59 -0500 (CDT) Message-Id: <199907131654.LAA13913@eeyore.cc.uic.edu> Received: (qmail 62249 invoked by uid 1000); 13 Jul 1999 16:56:53 -0000 Received: from localhost (HELO comp04.prc.uic.edu) (sendmail-bs@127.0.0.1) by localhost with SMTP; 13 Jul 1999 16:56:53 -0000 Reply-To: Lucas Bergman X-Mailer: nmh 1.0 (MH 6.8.3) From: Lucas Bergman To: "Derek Jewett" Cc: freebsd-questions@freebsd.org Subject: Re: Adding users... In-Reply-To: Your message of "Tue, 13 Jul 1999 08:58:06 PDT." <000801becd48$7fa40e70$5515a8c0@co.shasta.ca.us> Date: Tue, 13 Jul 1999 11:56:53 -0500 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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