Thursday, May 10, 2012

EMMA Report Comparison Shell Based Utility


Here i am pasting the Symbolic code for comparing two EMMA Reports where Assumptions are
1.before.txt ---> the actual report
2.after.txt----> report after modification

This Script will get in to those twpo reports and show block by Block Comparison
The idea behind sharing this is that using this Logic a Extensive User Utility script can be developed which can be used to compare EMMA Reports



function retLineNobefore()
{
Str=$1
while read Line
do
val=$(grep -n "$Str" | sed -n 's/^\([0-9]*\)[:].*/\1/p')   # this is to Extract just the Line no
break
done < before.txt
}

function retLineNoAfter()
{
Str=$1
while read Line
do
val=$(grep -n "$Str" | sed -n 's/^\([0-9]*\)[:].*/\1/p')
break
done < after.txt
}

rm -fr report.txt

retLineNobefore "OVERALL COVERAGE SUMMARY:"
no1=$val


retLineNobefore "OVERALL STATS SUMMARY:"
no2=$val
echo "----------------Before-------------------------- " > report.txt

awk "{if((NR>"$no1")&&(NR<$no2)) print}" before.txt  >> report.txt



retLineNoAfter "OVERALL COVERAGE SUMMARY:"
no1=$val
echo $no1


retLineNoAfter "OVERALL STATS SUMMARY:"
no2=$val
echo $no2
echo "----------------After-------------------------- " >> report.txt
awk "{if((NR>"$no1")&&(NR<$no2)) print}" after.txt  >> report.txt


No comments:

Post a Comment