how to put subject and body to mail from two files

Hi all,

My sample file is something like this,

ORA-00206: Message 206 not found;  product=RDBMS; facility=ORA

ORA-00202: Message 202 not found;  product=RDBMS; facility=ORA

ORA-27063: Message 27063 not found;  product=RDBMS; facility=ORA

ORA-00206: Message 206 not found;  product=RDBMS; facility=ORA

ORA-27063: Message 27063 not found;  product=RDBMS; facility=ORA

ORA-00221: Message 221 not found;  product=RDBMS; facility=ORA

I want to filter "ORA" codes (Ex: ORA-00206,ORA-00202..) and the other part in that line seperately.Then put ORA code part in to mail subject and other part in the mail subject and send mail for each line seperately.I want to do this for that file every hour.I have write script for that(ecept the every one hour part), with that I can do put the ORA code part to subject line but can't put the other part to the body of the mail.Please go thorough with my code and help me to do this.

awk '/ORA/ { print $0 }' awk1.log > new

a=0
while read LINE
do a=$(($a+1));
awk '/ORA-/ { print $0 }' new | cut -c -10 > new1
awk '/ORA-/ { print $0 }' new | cut -d ":" -f 2- new > new2
mail -s $LINE -r sj@xxxx.com sj@xxxx.com < /home/sss/new2 
echo $LINE;
done < new
echo "Final line count is: $a"; 

*** awk1.log is my original file and I grep only ORA line to 'new' file,then grep only ORA codes to 'new1' and other part to 'new2'.

*** I need grep code to grep awk1.log to 'new' every one hour.

not correct :

awk '/ORA-/ { print $0 }' new | cut -d ":" -f 2- new > new2 

correct :

awk '/ORA-/ { print $0 }' new | cut -d ":" -f 2- > new2 

remove the "new" that is in bold, give another try and let us know if things are still not working

... by the way,

aren't you willing to do a

awk '/ORA-/ { print $0 }' $LINE | cut -d ":" -f 2- > new2

instead of

awk '/ORA-/ { print $0 }' new | cut -d ":" -f 2- > new2

???

also consider generating new1 and new2 with 1 read of "new" file :

awk -F: '/ORA-/{print $1 >"new1";sub($1 FS " ",z);$1=$1;print $0 >"new2"}' new

or one read of $LINE

awk -F: '/ORA-/{print $1 >"new1";sub($1 FS " ",z);$1=$1;print $0 >"new2"}' $LINE