formatting the output

Is it possible to convert the attached file to the format mentioned.

Here for a particular job the table name and the corresponding instance name from one test run "X" is compared with the table name and the instance name from the second test run "Y" for output rows,affected rows,applied rows and rejected rows. The mismatching rows should be displayed in the format said above. If one table and a instance is present in either of the test runs then the format should be

Try this:

echo "JObID,Tablename,Instancename,output rows x,affected rows x,applied rows x,rejected rows x, output rows y,affected rows y,applied rows y,rejected rows y"
awk '
        /^Summary/ { testrun=tolower($9) }
        /^Job/ {
                gsub("[][~(),]","") # strip out the unwanted characters
                jobid=$3
                table=$5
                instance=$8
                rowindex[jobid SUBSEP table SUBSEP instance]
                output  [jobid SUBSEP table SUBSEP instance SUBSEP testrun]=$11
                affected[jobid SUBSEP table SUBSEP instance SUBSEP testrun]=$14
                applied [jobid SUBSEP table SUBSEP instance SUBSEP testrun]=$17
                rejected[jobid SUBSEP table SUBSEP instance SUBSEP testrun]=$20
        }
        END {
                OFS=","
                for (i in rowindex) {
                        split(i,a,SUBSEP)
                        jobid=a[1]
                        table=a[2]
                        instance=a[3]
                        print jobid,table,instance,
                                output  [jobid SUBSEP table SUBSEP instance SUBSEP "x"],
                                affected[jobid SUBSEP table SUBSEP instance SUBSEP "x"],
                                applied [jobid SUBSEP table SUBSEP instance SUBSEP "x"],
                                rejected[jobid SUBSEP table SUBSEP instance SUBSEP "x"],
                                output  [jobid SUBSEP table SUBSEP instance SUBSEP "y"],
                                affected[jobid SUBSEP table SUBSEP instance SUBSEP "y"],
                                applied [jobid SUBSEP table SUBSEP instance SUBSEP "y"],
                                rejected[jobid SUBSEP table SUBSEP instance SUBSEP "y"]
                }
        }
' inputfile | sort