pick correct message and mail.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting pick correct message and mail.
# 1  
Old 01-23-2007
pick correct message and mail.

Hi,

I have the following small script. How can I just print out the string with missing message and send to hotmail.com? Also,
can i set the message a bit more beautiful such as "Dear All, the following list is missing in our system"?

#!/bin/sh
MSG=/log
cat list11.txt |
awk ' BEGIN { flag = "y" }
{ if(str != substr($0,1,46))
{
if ( flag == "n" ) print str " is no missing"
str = substr($0,1,46);
seq = substr($0,47,51);
flag = "n"
}
else
{
seq1 = substr($0,47,51)
seq = int(seq) + 1;
if( seq != int(seq1) )
{
flag="y"
while( seq != int(seq1) )
{
printf("%s%05d%s\n", substr($0,1,46), seq, " is missing")
seq = int(seq) + 1;
}
}
}
}' > result.txt
cat result.txt | sort | cut -c 35-70 >> result2.txt
cp result2.txt /log/missing.msg
mailx -s \'"Missing tap file status'" xxxx#hotmail.com < $MSG/missing.msg

Last edited by happyv; 01-23-2007 at 11:34 PM..
# 2  
Old 01-24-2007
Try changing the last few lines to....

Echo "Dear All\nHere is the list etc etc \n\n" > result2.txt
cat result.txt | sort | cut -c 35-70 >> result2.txt
cat result2.txt | mailx -s "Missing tap file status" xxxx#hotmail.com

In regard to the hotmail email, your server must be configure to handle email requests being sent to the "outside world".....
# 3  
Old 01-24-2007
Quote:
Originally Posted by Andrek
Try changing the last few lines to....

Echo "Dear All\nHere is the list etc etc \n\n" > result2.txt
cat result.txt | sort | cut -c 35-70 >> result2.txt
cat result2.txt | mailx -s "Missing tap file status" xxxx#hotmail.com

In regard to the hotmail email, your server must be configure to handle email requests being sent to the "outside world".....
Great..Thx!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Should pick latest file within past 3 days using UNIX script and perform steps in message below.

Hi , Can anyone help me how do perform below requirement in unix. Step1:we will receive multiple files weekly with same name(as below) in a folder(In folder we will have other files also def.dat,ghf.dat) Filenames: 1) abc_20171204_052389.dat 2)abc_20171204_052428.dat DON'T modify... (23 Replies)
Discussion started by: sunnykamal59
23 Replies

2. Programming

Get correct mail id

Hi Team, I have below data , could you please help to get correct mail id in oracle only. bhatt,rabi rabi.bhatt@n.com, test, mishra test.mishra@n.com, skype, amit skype.amit@n.com, output like :rabi.bhatt@n.com test.mishra@n.com skype.amit@n.com Please use CODE tags as required... (6 Replies)
Discussion started by: Jewel
6 Replies

3. UNIX for Advanced & Expert Users

Mail -s help ,change the sender to correct one

Hi expert I use mail -s "hello" bruce@sohu.com <kernel-img.conf send mail, it display the sender is lyang001@lyang001-OptiPlex-9010.corp.ad..com How can I change the sender to yanglei.fage@gmail.com to default ? (1 Reply)
Discussion started by: yanglei_fage
1 Replies

4. Shell Programming and Scripting

perl script to check the mail ids in the correct format or not

Hi Folks, I have few mailids in a text file and need to check whether the mailid is in correct format or not. If just to check whether the string is a mailid or not there is a perl module Email::Valid to do the business or we can implement our own logic. But the mail_ids I am having is... (4 Replies)
Discussion started by: giridhar276
4 Replies

5. Shell Programming and Scripting

Turn Off the Message [YOU HAVE NEW MAIL]

#!/bin/sh cd /u02/app/ccalloc/dev/in CURDIR=`pwd` echo directory listing of $CURDIR echo ls -latr i have a basic shell script that displays a specific files on a directory. when the script is run and it does not find the file in the directory it display a first line message of how... (3 Replies)
Discussion started by: wtolentino
3 Replies

6. Shell Programming and Scripting

how to get the correct alignment in a textfile to a mail using shell script?

Hi All, Can any one solve this prob. Im sending a textfile content as a mail body while sending a mail using shell script. But, that textfile content is a unic command output. So, in mail, im not getting the correct alignment as in textfile. What may be the reason behind this. Can... (1 Reply)
Discussion started by: suman_dba1
1 Replies

7. Shell Programming and Scripting

Mail Message

Hi, Need a script bash,sh or perl doesn't metter, witch can read mail message text file and grep message body. Does it possible? (0 Replies)
Discussion started by: Mirror
0 Replies

8. UNIX for Dummies Questions & Answers

Return mail message

Hi I would like to know how interpret line by line a return mail message sent by unix mailer-daemon (2 Replies)
Discussion started by: alcvrjo
2 Replies

9. Shell Programming and Scripting

two files as a message in mail

i have two files --file1 and file2-- how should i send both the contents of files as a message in the mail body ali@unix.com i have written the script ---------------------------- #!/bin/ksh mail -s "the two files are" ali@unix.com < file1 < file2... (2 Replies)
Discussion started by: ali560045
2 Replies

10. Shell Programming and Scripting

Crontab Mail message

Hi When I make change in crontab entries , I get below message as a mail. Can any one tell me what this indicates? ********************************************* From wlsdev05 Fri Sep 22 02:11:23 2006 Date: Fri, 22 Sep 2006 02:11:23 -0400 (EDT) From: "Geff Thomson - " <wlsdev05>... (1 Reply)
Discussion started by: pankajkrmishra
1 Replies
Login or Register to Ask a Question