Answer the question
In order to leave comments, you need to log in
How to remove all numbers, spaces and dashes at the beginning of a string - in any order?
Hello everyone,
I want to optimize this terrible string so that it only starts with a letter
extracted_file_name=$(printf '%s' "$extracted_file_name" | sed -e 's/^*//' | sed -e 's/^[0-9]*//g' | sed -e 's/^*//' | sed -e 's/^[0-9]*//g' | sed -e 's/^*//')
Answer the question
In order to leave comments, you need to log in
it’s easier to go from the opposite, first remove everything that is not a letter
sed -e 's/^[^[:alpha:]]\+//'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question