LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Multi-users add for linux! Help me!!!! (http://www.linuxquestions.org/questions/programming-9/multi-users-add-for-linux-help-me-160116/)

yulitao 03-20-2004 02:21 AM

Multi-users add for linux! Help me!!!!
 
My problem is that now I have a userlist.ext file which includes over 1000 peoples, the format is
Username:Password:Groupname:Fullname. Now I want to creat a script on linux redhat 9 and the script will read the userlist file and check the new user's information one by one.if the user information is valid, it will create the account for the user and write the account information to a report file,I want to the report file's format is User_fullname:Account_name:user_id:group_id;created_date
if the new user's information is invalid, it will not create the account for the user. and the error information will be reported to me.
Please give me some hints if you know!!

guygriffiths 03-20-2004 05:39 AM

One word: Perl
It's designed for jobs like this. What do you mean by "valid user information"? If you list everything you need to check, I can help you write a script which would do the job (although I'm not a great programmer so it'll be messy, but it'll work).

Looking_Lost 03-20-2004 06:01 AM

As above, depends what you mean by "valid user information", should be fairly simple to parse each line in your existing file and output each line into a new file in the format that the newusers command can use to add all the users. It's probably better to use "valid" data from the outset then you are guaranteed it'll work rather than catch errors ad hoc as you go along.


All times are GMT -5. The time now is 11:12 PM.