This compares the whole file, writes all the credit problems to one file, all the debit problems to another, then sends all of the common problems in one email.
Code:
awk -F',' '{ if($1 != $3 ) {print $1, $3 > "debitfile"}
if($2 != $4 ) { print $2, $4 > "creditfile" }
} ' a.txt
$(echo "Hi All,
`awk '{ printf( "The sum of credit amount :%10f The sum of credit amount :%10f\n", $1, $2) creditfile`
Thanks
user_name" )|mailx -s "`date '+%d-%m-%y'` Debit Amount" $RECIPIENT
$(echo "Hi All,
`awk '{ printf( "The sum of debit amount :%10f The sum of debit amount :%10f\n", $1, $2) debitfile`
Thanks
user_name" )|mailx -s "`date '+%d-%m-%y'` Debit Amount" $RECIPIENT