cut from replay only digits?

Hello,
I’m using a script that show me the SIM number inside my router
sometime acoording to the ISP the sim is just numbers and in another ISP it have letters
for example :
SIM from ISP1 is 8912
SIM from ISP2 is 89
2F

how can I cut the “F” from the replay ?
the length doesn’t help me because its the same length for both cases

any one have an idea?

Thanks ,