b=${a:12:5}
INPUT='someletters_12345_moreleters.ext' SUBSTRING=$(echo $INPUT| cut -d'_' -f 2) echo $SUBSTRING
number=$(echo $filename | egrep -o '[[:digit:]]{5}' | head -n1)