I have the following string:
test1234a or test1234 for example and I want to extract only test from that string.
I tried the follwing
echo "Test12h" | sed -e 's/[0-9]\*$//' but is not working. 
Is there any possibility to extract the substring until first digit?
Please let me know what I miss.
Thank you
The proper tool for extracting substrings matching a regexp from a command's output is grep. Like,
echo "Test12h" | grep -o '^[^[:digit:]]*'
will output Test.
If Test12h is in a variable, you don't even need external utilities; parameter expansions can easily handle that, e.g:
var='Test12h'
echo "${var%%[[:digit:]]*}"
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With