Link to home
Start Free TrialLog in
Avatar of udutha_surendra
udutha_surendra

asked on

Help

Hi experts,

Please give me a solution to the below mentioned task:
Description:
1. shell script which querys oracle database and generate the csv file with date append.
2.shell script to send the above file to multiple receipients mentioned in the .cfg file

any one please help me out.

thanks in advance
SOLUTION
Avatar of Hanno P.S.
Hanno P.S.
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of udutha_surendra
udutha_surendra

ASKER

1.need to send mails to multiple reciepients which are mentioned in a configuration file as mentioned below
autoscr.cfg
yahoo:user1@abc.com:user2@abc.com user3@abc.com:user4@abc.com
rediff:user5@def.com:user6@def.com user7@def.com:user8@def.com

the above file contains list of mail id's mentioned as per domain specific(yahoo/rediff).
I need to read the above file as per domain and send attachment as csv file to the mentioned mail id's.
the above file contains mail id's seperated by ":"
I need to write a script that reads the above file and send the attachment.
can any one help me regarding this.
thanks in advance
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi expert,
thanks for your solution.
the code which you have sent not working and it is failing at "sed " command .
i want to read all the domanin specific mail id's and send an attachment in one go.
can you please help me to get the above requirement.

thanks

a) There was a typo, it should have read
      sed -e 's/:/ /g'
    Sorry for this!
b) If your config file has all the domains in front, seperated by colon from the rest
     Get all domains from this file:
        cut -d: -f1 autoscr.cfg

#!/bin/sh
 
domains=`cut -d: -f1 autoscr.cfg`
 
for domain in $domains ; do
  uuencode attach.csv < attach.csv | mailx -s "email with some stuff" \
      `grep "^$domain:" autoscr.cfg | cut -d: -f2- | sed -e 's/:/ /g'`
done

Open in new window