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,
But when I move to another server, the EOL seems to not affect,
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!