Bash Substring Syntax code example
Example 1: substring in shell script
STR="birthday-091216-pics"
SUBSTR=$(echo $STR | cut -d'-' -f 2)
echo $SUBSTR
Example 2: how to print substring in bash script
INPUT='someletters_12345_moreleters.ext'
SUBSTRING=$(echo $INPUT| cut -d'_' -f 2)
echo $SUBSTRING