A "pin number" is really a text object within a terminal group that is marked dyntext so it can print the display/name attribute of its parent object (the terminal group). The followign script removes these objects in four steps:
The script is:
Unselect(all) query(select, '@.type == TEXT && @.dyntext == 1 && @.parent.a.role == "terminal"') propset(p/floater, 1) RemoveSelected
This can be ran the usual ways, from the command entry from the GUI, or loaded from a file or from a shell using the batch HID. For more information, see the action class of pcb-rnd's scripting howto.
When ran from a shell, as an 5th step the SaveTo(sheet, filename) or the Export() action may be useful.