string="rob-espierre:V9_NOE"if[[$string=~ (^[a-z\-]*):([a-zA-Z0-9_]*)]]; thenhost=${BASH_REMATCH[1]}schema=${BASH_REMATCH[2]}echo$hostecho$schemaelseecho"No match found"fi
Case
1234567
# min to MAJa=toto
echo${a^^*}# MAJ to mina=TOTO
echo${a,,*}
Handling filenames
Examples below are inspired from bash manual pages, looking for parameter expansion.
12345678910111213141516171819202122
# Remove last extensionx="/foo/fizzbuzz.bar.quux"y=${x%.*}echo$y --> /foo/fizzbuzz.bar
# Remove everything after the first doty=${x%%.*}echo$y --> /foo/fizzbuzz
# Get raw filenamex="/foo/fizzbuzz.bar"y=${x%.bar}echo${y##*/} --> fizzbuzz
# Change extensionx="/foo/fizzbuzz.bar"y=${x/bar/txt}echo$y --> /foo/fizzbuzz.txt