Consider the following example - the selection could be automated if the target block/attribute tag is known, or alternatively, it could search every block attribute for the target field expression and perform a replacement:
(defun c:test ( / e n x )
(setq n "$(substr,$(getvar,dwgname),1,3)")
(while
(progn
(setvar 'errno 0)
(setq e (car (nentsel "\nSelect field: ")))
(cond
( (= 7 (getvar 'errno))
(princ "\nMissed, try again.")
)
( (null e)
nil
)
( (not (wcmatch (cdr (assoc 0 (setq x (entget e)))) "TEXT,MTEXT,ATTRIB,MULTILEADER,*DIMENSION"))
(princ "\nInvalid object selected.")
)
( (not
(and
(setq x (cdr (assoc 360 x)))
(setq x (dictsearch x "ACAD_FIELD"))
(setq x (dictsearch (cdr (assoc -1 x)) "TEXT"))
(setq x (cdr (assoc 360 x)))
(setq x (entget x))
(= "FIELD" (cdr (assoc 0 x)))
(= "AcDiesel" (cdr (assoc 1 x)))
)
)
(princ "\nThe selected object does not contain a DIESEL field expression.")
)
( (entmod
(subst
(cons 2 (strcat "\\AcDiesel " n))
(assoc 2 x)
(subst (cons 1 n) (assoc 1 (member (assoc 6 x) x)) x)
)
)
(command "_.regenall")
)
)
)
)
(princ)
)