Check for proper e mail id format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check for proper e mail id format
# 1  
Old 08-22-2007
Check for proper e mail id format

Hi,
We run an application called meta which reads user information from database and updates in LDAP.For that we have some scripts to check the uniqueness of mail ids between the existing LDAP and Database.It works fine when people enter mail ids in proper format (xxx.yyy@abc.com) but if it entered in wrong format (x 99 yy abc@com) the uniqueness check fails. We extract the mail ids in a text file before adding. Can you suggest any script which will remove the wrong entry. We use solaris 9 as OS.
Thanks in advance
# 2  
Old 08-22-2007
try this:

for emailid in $(cat filename) ; do
echo $emailid | awk -FS="@" '{
if ( $1 == "" || $2 == "" || $2 !~ /\./ )
print "Invalid Id"
else
print "Valid Email Id"

}
# 3  
Old 08-23-2007
Thanks for idea

Smilie Thanks for the idea.Can you just provide me one more idea? If i want to read 1st column of some EXEL format file having two columns how do I do that?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combine multiline to one line with proper format

Hello Guys, I have a file say FILE1.txt contains below data:- A B C D E F G H I J K L I need the output in another file as FILE2 as:- 'A', 'B', 'C', 'D', 'E', (7 Replies)
Discussion started by: jassi10781
7 Replies

2. Shell Programming and Scripting

Need to grep this Data in proper format:- Please Guide

Hi Guys, I need to grep below data in this format backup_id creation expiration policy sched_label backup_id = picoserver38_1212077050, version = 2 creation = 05/29/2008 18:04:10 (1212077050) expiration = 06/29/2008 18:04:10 (1214755450) retention_level = 3, fragment = 2, file_num = 1... (14 Replies)
Discussion started by: manalisharmabe
14 Replies

3. Shell Programming and Scripting

Awk - Summation in Proper decimal Format

Hi I am executing below command to do summation on 46th coloumn. cat File1| awk -F"|" '{p += $46} END { printf"Column Name | SUM | " p}' I am getting output as Column Name | SUM | 1.01139e+10 Here I want output in Proper decimal format. Can someone tell me what change is required for same? (1 Reply)
Discussion started by: sanranad
1 Replies

4. Shell Programming and Scripting

perl script to check the mail ids in the correct format or not

Hi Folks, I have few mailids in a text file and need to check whether the mailid is in correct format or not. If just to check whether the string is a mailid or not there is a perl module Email::Valid to do the business or we can implement our own logic. But the mail_ids I am having is... (4 Replies)
Discussion started by: giridhar276
4 Replies

5. Solaris

how to check links exists proper or not in solaris 10

Hi, I am using solaris 10 OS and Bash shell.I am looking for the command to check whether link is exits or not.if not i have to create it Requirement here is say in the server1 i have a directory /spa/5.0.in that directory there are so many links exist. Example links: genver ->... (7 Replies)
Discussion started by: muraliinfy04
7 Replies

6. Shell Programming and Scripting

Need to split a xml file in proper format

Hi, I have a file which has xml data but all in single line Ex - <?xml version="1.0"?><User><Name>Robert</Name><Location>California</Location><Occupation>Programmer</Occupation></User> I want to split the data in proper xml format Ex- <?xml version="1.0"?> <User> <Name>Robert</Name>... (6 Replies)
Discussion started by: avishek007
6 Replies

7. Shell Programming and Scripting

Getting Proper Date Format in SH Script

There's a small SH script I'm trying to write where it will get the current month and find a log file that is based on the date. Example: Today is February, so the log file is going to be 201102.log (2011 + 02) An additional thing is that if today is the 1st of a month, it will also find the log... (3 Replies)
Discussion started by: kooshi
3 Replies

8. UNIX for Dummies Questions & Answers

check file is a proper flv

Hello, On a linux server (centos 5.4), users upload file that should be flv. How can I check that the file is a real and proper flv file? Checking the extension is not enough! Thanks (1 Reply)
Discussion started by: JCR
1 Replies

9. Shell Programming and Scripting

Output file not displayed in the proper format

Hi am using uuencode fro attaching one report which is nothing but sql query output. But when i receive the report through attachement and when it is opened the report is not displayed in proper format. Means if the sql query has 100 rows the mail attachment report displays the report in 2... (2 Replies)
Discussion started by: weknowd
2 Replies

10. Shell Programming and Scripting

Net::SSH::Perl ...... how to print the output in a proper format

Hi Guys, my $cmd = "ls -l"; #........ {or let it be as # my $cmd= "ls"; } my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("$cmd"); print $stdout; the script works fine, but i am unable to see the output getting displayed in a... (7 Replies)
Discussion started by: gsprasanna
7 Replies
Login or Register to Ask a Question