Need Script to Validate and Add more users one time

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Script to Validate and Add more users one time
# 1  
Old 02-09-2008
Need Script to Validate and Add more users one time

I need a script to validate and add more than one user at one time
Field 1 - FirstName LastName Field 2 - userid Field 3 - email address Field 4 - department

Validation for Field 1
  • No special characters
  • No Numerbers
if name contains @ must change character to 'alias'

Validation for Field 2
  • Must be alpha numeric
  • No Special characters except "underscore"

Validation for Field 3
as per normal email validation

Validation for Field 4
  • Can be anything, alpha numeric except special characters

SmilieSmilieCan any one help me ?SmilieSmilie
# 2  
Old 02-09-2008
There is no way to help you with such extremely vague requirements. You may as well ask:

build me a widget and make it out of some watchamacallit
What language are you needing the script written in? Add users to what? Is the input from the command line or from files or from a CGI form or a database or the planet Venus?
# 3  
Old 02-09-2008

Sorry Kevin,

I am going to use this in solaris. any shell can be used.

i have given an csv file with new users names to add.

the content of users.csv

jack dsouza,jackd123,,it operations
upto 6000 lines

i need to validate the file, if the names or userids or email is not according to the format then it has to be written to a new file

It will be better if i get a separate script to validate csv file with contents like above and another separate script to mass user add.

Please advice
# 4  
Old 02-10-2008
Validating an email address is not easy but at least we know the format of an email address and what would be valid and what would be invalid. Validating a name, an id, and a department are not standard types of data so you will need to define exactly what those fields should contain to be considered valid and what they should not contain to be considered invalid. The actual script should be very straight forward once you establish what the criteria is for validating the data.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to add missing date and time in a bash script?

Hi Again, I have a file that contains date and time for the past 2 hours. What i need is add missing date and time in a file. INPUT 2016-01-13 01:33 10 2016-01-13 01:31 10 2016-01-13 01:30 10 2016-01-13 01:29 10 2016-01-13 01:28 10 2016-01-13 01:27 10 2016-01-13 01:26 10 2016-01-13... (14 Replies)
Discussion started by: ernesto
14 Replies

2. Shell Programming and Scripting

Validate date and time in filename by awk

hi i want to validate the date and time in filename filename : mohan.moh.ccyymmdd.ccyymmdd.hhmmss.txt mohan_moh.20151222.20151222.122442.txt i want code that check that date given in filename 20151222 in this format ccyymmdd else it mark file is not valid used in my OS detail is AIX 6... (12 Replies)
Discussion started by: MOHANP12
12 Replies

3. Shell Programming and Scripting

Script to add new users to a group on multiple servers using SSH

Hi Experts, I am new to scripting. We have around 400 Linux servers in our environment. I want to add a new user to a perticular group on all the servers using SSH. Requirements: 1) Need to take the server names from a text file. 2) Login into each server and check whether perticular... (1 Reply)
Discussion started by: Satya1983
1 Replies

4. AIX

Script to validate between two environments

Hi, I trust that you are well - I'm a bit new into AIX and I've been assigned a task to write a script that will always validate between our two Prod (Prod A and Prod B) environments to confirm which prod we live at. The two environments are exact replicas and this check I need to put in... (5 Replies)
Discussion started by: Twaggzk
5 Replies

5. Shell Programming and Scripting

Please help me validate script

Hi Guys, Im a newbie to scripting and have a small assignment. can someone please confirm if the script i have written would work fine as we dont have a test server to test :( Scenario - copy 2 files from an ftp server (windows) to a linux machine (a perticular folder). run 2 different... (0 Replies)
Discussion started by: nishantvshah
0 Replies

6. Shell Programming and Scripting

Addsudoers: A script to add users or groups into /etc/sudoers

Well, sudo is a great tool for delegating permissions among admins. But, it's really hard to find a great tool which would give an interactive way of editing /etc/sudoers file. Now, when I say "editing", I really refer to add new groups, users, aliases in the /etc/sudoers file. visudo is great... (2 Replies)
Discussion started by: admin_xor
2 Replies

7. Solaris

Shell script to add users on solaris

Hi admins, I am trying to run a script to add users on solaris with password: I am using crypt for passwords: The part of my scripts is as below: if ; then echo "$username exists!" exit 1 else pass=$(perl -e 'print... (5 Replies)
Discussion started by: snchaudhari2
5 Replies

8. UNIX for Dummies Questions & Answers

script to add 10000 users

Hi All i have written the script to add 10000 users, when i execute the script it had no errors ,but the script is not adding the users. pls correct me. i want it using while loop #!bin/sh count=0 while do useradd username$count count=`expr $count + 1` done ~ (2 Replies)
Discussion started by: kalyankalyan
2 Replies

9. Shell Programming and Scripting

Validate time pattern using regular expression

Hi, I am new to scripting. please help me in validating the user entered time Pattern Here is the program #!/bin/bash validateTimeFormat() { checkTime=$1 timePattern="::" if ] then echo "Valid time pattern" return 1 else echo "InValid time pattern" return -1 fi } echo "Please... (2 Replies)
Discussion started by: vvenu88
2 Replies

10. Shell Programming and Scripting

Script to add time convert to seconds

Hi, What i am looking for and i am new to this too, is a bash script that will add time in the format hh:mm:ss and produce the answer in minutes or seconds. It needs to be a loop since there are hundreds of times in my file. This is data is from a CDR that calculates duration of time used. ... (2 Replies)
Discussion started by: trotella
2 Replies
Login or Register to Ask a Question