Re: user adding
Antonio Galea <[email protected]> Fri, 25 Jul 2003 10:42:12 +0200 (CEST)
| Newsgroups | gmane.linux.redhat.release.enigma |
|---|---|
| Message-ID | <Pine.LNX.4.44.0307251032070.2957-100000@beastieboy.uff.netwise.it> |
Sorry for the previous empty email... still sleeping ;-)
> I have a file with 50 lines (simple text file with 4 fields in each
> row)
> abc 123 acds qwertt
>
> now what i want is add 50 users with last field of
> each row as user name and first 3 fields as gcos (user
> info)
> how can i do it with automated scripts ?
>
Try this:
#perl -nwe'($a,$b,$c,$user)=split;print "useradd -c \"$a $b $c\" $user\n";' FILENAME
it will convert your data into system commands. Beware of quotes in the
datafile, though.
HTH,
Ant9000
--
_____________________________________________________________________________
Dr. Antonio Galea N e t W i s e http://www.netwise.it
Sviluppo tecnico Tecnologie per il Web Tel 0461.421016 Fax 0461.426021
-----------------------------------------------------------------------------
If you tell the truth, you don't have to remember anything.
Mark Twain
-----------------------------------------------------------------------------
--