Perhaps like this, untested
Code:
(if
(setq sset (ssget "_X" (list (cons 0 "mtext" )(cons 1 "G-OJ (*,* G-OJ (*"))))
(progn
(setq fam "G-OJ"
sum 0)
(while (setq en ( ssname sset 0))
(setq elist (entget en))
(setq txt (cdr (assoc 1 elist)))
(setq pos (vl-string-search "G-OJ (" txt))
(setq txt (substr txt (+ pos (strlen "G-OJ ("))))
(setq txt (vl-string-subst "" "(" txt))
(setq txt (vl-string-subst "" ")" txt))
(setq txt (vl-string-subst "" "}" txt))
(setq num (atoi txt))
(setq sum (+ sum num))
(ssdel en sset)
)
(alert (strcat "Sum of " fam " is : " (itoa sum) " plants"))
)
)