This one-liner strips all numbers from any string. I show it in BASH using sed which does a RegEx expression to match only digits. Python has the built-in function str.isdigit() so we test each character and make a list comprehension then return it to a string.

BASH

export MYSTRING="15g6o86o2d126b9y0e5-343n6u7m8be9r32s8"
echo $MYSTRING | sed 's/[0-9]//g'

Python

export MYSTRING="15g6o86o2d126b9y0e5-343n6u7m8be9r32s8"
python -c "print(''.join([i for i in '$MYSTRING' if not i.isdigit()]))"

Result: goodbye-numbers

Tagged on: