How about using grep -E?
grep -E
echo "This is 02G05 a test string 20-Jul-2012" | grep -Eo '[0-9]+G[0-9]+'
The pattern \d might not be supported by your sed. Try [0-9] or [[:digit:]] instead.
\d
sed
[0-9]
[[:digit:]]
To only print the actual match (not the entire matching line), use a substitution.
sed -n 's/.*\([0-9][0-9]*G[0-9][0-9]*\).*/\1/p'
sed doesn't recognize \d, use [[:digit:]] instead. You will also need to escape the + or use the -r switch (-E on OS X).
+
-r
-E
Note that [0-9] works as well for Arabic-Hindu numerals.