Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash get first number from string

#credit to the Stack Overflow user in the source link
echo $string1 | sed 's@^[^0-9]*([0-9]+).*@1@'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #bash #number #string
ADD COMMENT
Topic
Name
2+4 =