Comparing two files on row by row and send the report

Comparing two files on row by row

File1

ecount~100
dcount~200
ccount~300
zxcscount~5000
and so on.

File2

ecount~100
dcount~203
ccount~300
zxcscount~5000
and so on.


If i use diff command 
2c2
< dcount~203
---
>dcount~200

Actual output :

If all counts not matched then send the below report to every one and script should get fail.

name~file1count~file2count~status
ecount~100~100~Matched 
dcount~200~203~NotMatched 
ccount~300~300~Matched 
zxcscount~5000~5000~Matched 

and so on.

if the all counts are matched then send only the report

thanks,
onesuri

The following produces an answer which is identical to the one you specified. It may not be the best way to do the task, but it should be easy to understand.

awk_script='
BEGIN   {
        print "name~file1count~file2count~status"
}

        {
        if ($2 == $4) {
                status = "Matched"
        } else {
                status = "NotMatched"
        }
        printf "%s~%s~%s~%s\n", $1, $2, $4, status
}

'

        paste -d '~' File1 File2 | awk -F '~' "$awk_script" > Report

From here the task of sending the report should be straightforward.