Distibution of Excel file.

Hi,

I have a requirement where I have list of Excel files (with multiple tabs) placed in Unix directory.The naming convention is [Timestamp]_<Code> where <Code> is unique indentifier for each file. In a database table, I have Distribution list for each code. I want to write a shell script , which will basically pick each file one by one , Check for <Code> value, Connect to database to extract distribution list and send the Excel file to distribution via email. Please help me with the sample script to capture this requirement.

Thanks for you help.
Anil Kumar

Hi Anil,

select * from distribution;
1 a.b@gmail.com
2 b.b@gmail.com
3 b.c@gmail.com
4 t.c@gmail.com
5 tt.c@gmail.com
##################

 
cd /home/beherabi/dist
for i in `ls -1|cut -d "_" -f2`
do
a=`sqlplus -s scott/tiger@orcl<<here
set heading off;
select dist from distribution where unival=$i;
exit;
here`
echo "$a"
done

####################
will give the output
[EMAIL="a.b@gmail.com"]

[/EMAIL]so you need to change the line(echo "$a") to some corresponding sendmail or other
mailing utility with your excel file and the distribution(which is nothing but the $a).
hope this will help you
Regards,
sanjay.