Need help in scripting

Hi,

I have a requirement to write a shell script to judge/identify the records whether the email is good or bad. Below is the pre-requisites client has given

Valid domains for email address acceptable as "COM,EDU,NET,ORG,INT,GOV,MIL,AERO,BIZ,COOP,INFO,MUSEUM,NAME,PRO"

and also need to check the below conditions

a) 'Characters ()<>,;:\/"''[] or spaces are not permitted in an email address.';
b) 'An email address cannot contain control characters or DEL.';
c) 'An email address cannot begin with the dot or at-symbol.';
d) 'Names like root, webmaster etc. are unacceptable.';
e) 'An email address cannot have a dot immediately after the at-symbol . ';

e.g :- A file contains data as below

1002334|a.neryariel@verizon.net|ARIEL|TELLEZ|9780545546379|1049622|Jeffry|9780545365765|9780545366847|1049641|Alfonso																																								201404
1004888|hogardesilva@gmail.com|MARTIN|SILVA|9780545505994|||||1328346|Emilio
6884268|info@ramonaprivateschools.com|Ellen|Kelly||||||1329346|Rajesh
55852010|myorders@conways.mobi|Yasaswini|konaganti||||||1579326|Ramu
56031277|administrator@leland.k12.mi.us|bharathi|katragadda||||||3429343|Suresh

Based on the above file, we need to write a script to move the bad email data into a separate file. Seems that the bad emails are as follows.

bademail data and these will be write it into a separate file.

6884268|info@ramonaprivateschools.com|Ellen|Kelly||||||1329346|Rajesh
55852010|myorders@conways.mobi|Yasaswini|konaganti||||||1579326|Ramu
56031277|administrator@leland.k12.mi.us|bharathi|katragadda||||||3429343|Suresh

I am unable to get a thought to write the commands in scripting. could you please help me out.

Thx in advance

All right, what you have tried so far ? you are member since 2006, why don't you follow forum rule ? I mean why you did not use code tags ?

Here are some thoughts for you to start the scripting:

  • what tool is most apt for the task?
  • Is the e-mail- address always in the same field? Which field? What be the field separator?
  • How do you supply the domains and the names like root etc.? In text files? Hard coded?