Sponsored Content
Full Discussion: Sendmail, EOL not effecting
Top Forums Shell Programming and Scripting Sendmail, EOL not effecting Post 302270627 by cv_pan on Monday 22nd of December 2008 10:31:22 AM
Old 12-22-2008
Sendmail, EOL not effecting

Hello,
I am using the following script to read some log and then contruct my email for notification.

When I run this on my test server, i am getting the output as below,
Quote:
Divison Name: International Private Banking Solutions
Divison Number: 13
Suspended Rule Code + Rule Name: P123 High wire count personal
Time of Suspension: 2008-12-15 08:42:30.549502
Disclaimer: THIS IS AN AUTOMATED E-MAIL. PLEASE DO NOT REPLY TO THIS ADDRESS.
But when I move to another server, the EOL seems to not affect,
Quote:
Divison Name: International Private Banking Solutions Divison Number: 13 Suspended Rule Code + Rule Name: P123 High wire count personal Time of Suspension: 2008-12-15 08:42:30.549502
Disclaimer: THIS IS AN AUTOMATED E-MAIL. PLEASE DO NOT REPLY TO THIS ADDRESS.
should I use some setting so the output is consistent across servers?

while true; do
sleep 30
if [ -a $FILE_NAME ]; then
curr_rec_cnt=`grep '^AML Rule' $FILE_NAME | wc -l`
else
curr_rec_cnt=0
fi

#echo $curr_rec_cnt
while [ $prev_rec_cnt -lt $curr_rec_cnt ]
do
#echo $prev_rec_cnt , $curr_rec_cnt

#Check if there are more than one records to notify
i=`expr ${line_count} + 1`
j=`expr ${line_count} + 9`

sed -n $i,"$j"p $FILE_NAME > $LOG_DIR/mailBuffer

prev_rec_cnt=`expr $prev_rec_cnt + 1`
line_count=$j

SUBJECT=`grep 'AML Rule' $LOG_DIR/mailBuffer`

echo "$MAIL_DIS_TO" >> $LOG_DIR/mailContent.dat
echo "$MAIL_FROM" >> $LOG_DIR/mailContent.dat
echo "$MAIL_PRIORITY" >> $LOG_DIR/mailContent.dat
echo "Subject: $SUBJECT" >> $LOG_DIR/mailContent.dat

awk '/AML Rule/{c=5;next}c{c--;print}' $LOG_DIR/mailBuffer >> $LOG_DIR/mailContent.dat
echo "$MAIL_DISCLAIMER " >> $LOG_DIR/mailContent.dat
cat $LOG_DIR/mailContent.dat | sendmail $MAIL_DIS_TO

rm $LOG_DIR/mailContent.dat $LOG_DIR/mailBuffer
sleep 30
done
done

Thanks!
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using Unix screen cmd effecting Vi editor

Hello, I enjoy using the unix screen utility, but my vi sessions lose the ability to syntax highlight code and split screen(:vs or :sp). When not using screen, I can do those things within vi. Anybody experience this and know the fix? Thanks (1 Reply)
Discussion started by: geephei
1 Replies

2. Shell Programming and Scripting

Remove EOL selectively

Hi, I have a text as below test1 test2 test3\ test4 test5 test6 test7 newtest1 newtest2\ newtest3 newtest4 newtest5 And need this to be replaces to test1 test2 test3 test4 test5 test6 test7 newtest1 newtest2 newtest3 newtest4 newtest5 So my requirement is to remove the EOL... (5 Replies)
Discussion started by: praveenbvarrier
5 Replies

3. How to Post in the The UNIX and Linux Forums

Delete to eol after PASS with sed

working on script and saving ftp log before log save want to remove the password password appears after constant "PASS" thanks pp (1 Reply)
Discussion started by: ppaprota
1 Replies

4. Linux

How to insert EOL?

How can I insert End of line (EOL) in Unix to file. Thanks (5 Replies)
Discussion started by: mrn6430
5 Replies

5. AIX

How to remove ^M from the EOL?

The only way I know of is manually as follows: To remove for example ^M from a file: - vi the file name that has ^M at the end of each line. - Hit <Esc> - Type :g/ - Hold the CNTRL key and press V and M then release the CNTRL key At the buttom you should see this by now: ... (3 Replies)
Discussion started by: mrn6430
3 Replies

6. OS X (Apple)

No eol in swap file

I was editing a file with vi and crashed so when I opened the file again I had the .swp file to deal with. I made the wrong choice trying to recover my file and wound up with a file with no eol (end of line) characters. I have forgotten the code to substitute and don't want to make an even... (2 Replies)
Discussion started by: gale
2 Replies

7. What is on Your Mind?

Internet Explorer EOL

Hard to imagine that in the two decades of its existence this product once ruled supreme, but the news is finally there: RIP Internet Explorer: Twitter mourns and mocks death of Microsoft (0 Replies)
Discussion started by: figaro
0 Replies
File::Find::Object::Rule::Extending(3pm)		User Contributed Perl Documentation		  File::Find::Object::Rule::Extending(3pm)

NAME
File::Find::Object::Rule::Extending - the mini-guide to extending File::Find::Object::Rule SYNOPSIS
package File::Find::Object::Rule::Random; use strict; use warnings; # take useful things from File::Find::Object::Rule use base 'File::Find::Object::Rule'; # and force our crack into the main namespace sub File::Find::Object::Rule::random () { my $self = shift()->_force_object; $self->exec( sub { rand > 0.5 } ); } 1; DESCRIPTION
File::Find::Object::Rule inherits File::Find::Rule's extensibility. It is now possibile to extend it, using the following conventions. Declare your package package File::Find::Object::Rule::Random; use strict; use warnings; Inherit methods from File::Find::Object::Rule # take useful things from File::Find::Object::Rule use base 'File::Find::Object::Rule'; Force your madness into the main package # and force our crack into the main namespace sub File::Find::Object::Rule::random () { my $self = shift()->_force_object; $self->exec( sub { rand > 0.5 } ); } Yes, we're being very cavalier here and defining things into the main File::Find::Object::Rule namespace. This is due to lack of imaginiation on my part - I simply can't find a way for the functional and oo interface to work without doing this or some kind of inheritance, and inheritance stops you using two File::Find::Object::Rule::Foo modules together. For this reason try and pick distinct names for your extensions. If this becomes a problem then I may institute a semi-official registry of taken names. Taking no arguments. Note the null prototype on random. This is a cheat for the procedural interface to know that your sub takes no arguments, and so allows this to happen: find( random => in => '.' ); If you hadn't declared "random" with a null prototype it would have consumed "in" as a parameter to it, then got all confused as it doesn't know about a '.' rule. NOTES ABOUT THE CALLBACK
The callback can access the File::Find::Object::Result using "$self->finder->item_obj()". AUTHOR
Richard Clamp <richardc@unixbeard.net> COPYRIGHT
Copyright (C) 2002 Richard Clamp. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
File::Find::Object::Rule File::Find::::Rule::MMagic was the first extension module for File::Find::Rule, so maybe check that out. perl v5.14.2 2012-05-05 File::Find::Object::Rule::Extending(3pm)
All times are GMT -4. The time now is 12:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy