I have a string like this.
30: sometext 57: sometext ....
I want to iterate over the numbers that come before the colon inside a shell script.
With egrep - Vertical Output
echo "30: sometext 57: sometext" | egrep -o '[0-9][0-9]'
30
57
With awk - Horizontal Output
echo "30: sometext 57: sometext"|awk -F'["|:| ]' '{print $1, $(NF-2)}'
30 57
grep -oP '\d+(?=:)' <<< $yourString