grep question

Hello,
Is there a way in grep to remember patterns?

For eg: int a,b,c,d,a;

If a variable is declared twice, like in the previous example, I should be able to print only those lines.

Is there a way to print only the lines where the variable name occurs more than once, using grep only?

Thanks,
Prasanna

use egrep which will work everywhere, even Solaris:
find repeating character a

egrep 'a.{2,}' filename

finds line with 2,3, ... 256 a's in it

edit: my keyboard is dying and I cannot type well normally...