how are you calculating the count.
If you dont mind can we have the sample of your data file and that part of script which calculates the count
I also want to know what does this count refer to, is it the number of lines of the output of egrep. if it is so, then use egrep -c. are you counting the number of lines in the fileout. I think that is where you might possibly doing it wrong.
If this is still not clear, please explain the scenario in more details