try this
; Delete Null Objects
;; DelNul.lsp
;; Deletes nul lines of Text, Mtext & Blocks.
;; Modified by JL Thomas 12/02/97
(Defun C:DelNul ( / TXT BLK NB NAMES)
(if(setq TXT (ssget "X" '((-4 . "<and")(-4 . "<or")
(0 . "MTEXT")(0 . "TEXT")
(-4 . "or>")(-4 . "<or")
(1 . "")(1 . " ")(1 . " ")(1 . " ")
(1 . "{}")(1 . "{ }")(1 . "{ }")(1 . "{ }")
(1 . "{}\P")(1 . "{ }\P")(1 . "{ }\P")(1 . "{ }\P")
(-4 . "or>")(-4 . "and>"))))
(progn
(command"_erase"TXT"")
(princ(strcat"\n "(itoa(sslength TXT))" nul text strings deleted. "))
)
(princ"\n No nul text strings found. "))
(setq BLK(tblnext"BLOCK"T)NAMES nil)
(while BLK
(if(=(cdr(assoc 0(entget(cdr(assoc -2 BLK)))))"ENDBLK")
(progn
(if(setq NB(ssget "X" (list(assoc 2 BLK))))
(command"_erase"NB"")
)
(setq NAMES(cons(cdr(assoc 2 BLK))NAMES))
)
)
(setq BLK(tblnext"BLOCK"))
)
(if NAMES
(progn(textscr)
(princ"\n Nul blocks found and need purging: ")
(foreach X NAMES(princ"\n ")(princ X))
)
(princ"\n No nul blocks found. ")
)
(princ)
)
(c:DelNul)