I have tried to extract a number as given below but nothing is printed on screen:
echo \"This is an example: 65 apples\" | sed -n \'s/.*\\([0-9]*\\) apples/\\1/
A simple way for extracting all numbers from a string
echo "1213 test 456 test 789" | grep -P -o "\d+"
And the result:
1213 456 789