diffrent results between command line and scripted grep

When I type a command at the command line it supplies one result and the exact same command in a script

egrep '^01|^02|^03|^04' file > fileout

count = 29353

same count in the script yields a count of 23492

is there any reason this could be happening.

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

warm regards