I have string contains a path
string=\"toto.titi.12.tata.2.abc.def\"
I want to extract only the numbers from this string.
To extrac
Here is a short one:
string="toto.titi.12.tata.2.abc.def" id=$(echo "$string" | grep -o -E '[0-9]+') echo $id // => output: 12 2
with space between the numbers. Hope it helps...