Email sending attachement with two file comparision


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Email sending attachement with two file comparision
# 1  
Old 01-25-2009
Email sending attachement with two file comparision

Hi guys,

I have two files . One file contains log record and another file contains emailids which is supposed to send it users

File1 :
Name : abc_xyz_data.txt
Which contains log record

File 2 :
Name : abc_xyz_mailids.txt
Which contains emailids.
abc@test.com
bcd@test.com

I would like to compare two file names
abc_xyz_data.txt=abc_xyz_mailids.txt

abc_xyz =abc_xyz are equal then file1 record should send it to
File 2( emailids list people) to log record.
Plese help to write a shell script

I am using kornshell to write shell script. Please help me

Regards,
orabalu
# 2  
Old 01-25-2009
Hi Anyone,

Please help me . I would appreciate your help.

Regards,
orabalu
# 3  
Old 01-26-2009
Hi Guys,

Please help me regarding my question.

Regards,
orabalu
# 4  
Old 01-26-2009
It's not allowed to bump up questions, please read the rules.

Regards
# 5  
Old 01-26-2009
This should work for you if I understood your question:

#!/bin/ksh
for DATAFILE in `ls *data.txt`
do
FILE=`ls $DATAFILE | awk -F_ '{print $1"_"$2}'`
if [ -s $FILE*"mailids.txt" ]
then
for MAIL in `cat $FILE*"mailids.txt"`
do
mail -s "Put Subject Here" $MAIL < $DATAFILE
done
fi
done
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX attachement email

I am having an issue sending a text file as an attachment. It is an oracle sql report generated as text. The file is formatted fine. However, when it is emailed and opened in notepad it is missing new lines and not not formatted properly. It is on solaris 10. Here is my code: #! /bin/ksh... (1 Reply)
Discussion started by: mrn6430
1 Replies

2. Shell Programming and Scripting

Sending csv file as an attachement from Linux

Hi i am trying to send a csv file as an attachment via mail from linux. i am using the below script. echo "X-Mailer: htmlmail" $VERSION echo "Mime-Version: 1.0" echo 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"' echo '---q1w2e3r4t5' echo "Content-Type: text/html; charset=US-ASCII"... (1 Reply)
Discussion started by: mohanalakshmi
1 Replies

3. UNIX for Dummies Questions & Answers

Sending email with file names

i need to send an email to users on the files being loaded...how can i achieve this? say, my source file directory has 2 files file1.txt file2.txt I just want to send an email saying these files were loaded...Please help (1 Reply)
Discussion started by: saggiboy10
1 Replies

4. Shell Programming and Scripting

Mail sending with multiple attachement(pdf and csv) with html content from Linux

Hi, We have a requirement to send multiple attachment(pdf and csv) along with html content in a single mail. For that we are using uuencode. It is working for single pdf attachment and html content. But we are unable to send both pdf and csv attachment with html content. Below is the script.... (5 Replies)
Discussion started by: dholea
5 Replies

5. Shell Programming and Scripting

Sending a file as an attachment to email

The file is located under appl/batchdata/ file name: storesales.txt I am using following code because uuencode is not present. I am not getting the data in file but i am getting the blank file with same name as an email attachment. ( echo "from: sch@xxxx.com" echo "to:sch@xxxx.com" echo... (2 Replies)
Discussion started by: skatpally
2 Replies

6. Shell Programming and Scripting

sending email in case of file not found

Hi, In the shell script, i want to do sftp and go to a directory and check if a particular file is present, if not i send an email with some error message. Please guide me about how i could achieve it...." (1 Reply)
Discussion started by: sJohn
1 Replies

7. Shell Programming and Scripting

Attaching .csv file and sending email

I need help with writing a shell script for writing data from a table into a .csv file and send the file has email attachment. I stuck up with attaching the file to the email. Thanks, (1 Reply)
Discussion started by: Beena
1 Replies

8. Shell Programming and Scripting

sending attachement in mail

Hi , I am using the below code to send mail through a script which run as a cron job. msgdate=`date +"%a, %e %Y %T %z"` daemail=$(cat <<! From: $from To: $emailtarget Subject: $subject Mime-Version: 1.0 Content-Type: multipart/mixed; Content-Disposition: inline $priority $CONTENT !)... (2 Replies)
Discussion started by: ahamed
2 Replies

9. Shell Programming and Scripting

Sending attachement using mailx

Hi I tried reading docs from this forum and googled it...but i couldnt get the answer for attaching a document in mail. I need it to be the actual attachement not adding the content of the file to the body of the mail.. i used uuencode ...to encode the file but it is coming as a junk... (4 Replies)
Discussion started by: aemunathan
4 Replies

10. UNIX for Dummies Questions & Answers

Send email with attachement-Getting connection refused by domain

Hi all, I am a newbie to unix. I need to send an email with an attachment in unix to some id like abc@some_company.com Code i have used is ------------Code--------------------------- #!/bin/ksh set -x #set -n #cript: unix_mail_withattachments.ksh # Aurthor: Ravin Maharaj #... (1 Reply)
Discussion started by: samuelc
1 Replies
Login or Register to Ask a Question