Shell Script
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   amar_kumar
Posted On:   Thursday, April 10, 2008 06:11 AM


Hi I'm a newbie in shell scripting


My requirement is I need to read a coma separated file which contains the username and emailid.I need to read that file and send email to that username
sample textfile


amar,amar.tumma@yahoo.com

kumar,ss@yy.com


Any idea is highly appreciable.
Regards
Amar

Re: Shell Script

Posted By:   Anonymous  
Posted On:   Wednesday, April 23, 2008 05:17 PM

Hi Amar,
If u require only the shell script then it will be like this.

Suppose ur text file is abc.txt
and containts
-----------------------------
mar,amar.tumma@yahoo.com
kumar,ss@yy.com
-----------------------------
the script to read and mail is,
***************start**************
#!/usr/bin/ksh

#this is to cut the specific fields
while read line
do
export name=`cut -f1 -d, $line`
export email_id=`cut -f2 -d, $line`

#this is to send the mail to email_ids
echo "Hi ${name} test mails"|mailx -s "test" ${email_id}
done < abc.txt

**************end***************



thanks
Priya
About | Sitemap | Contact