shell replace or write new string code example
Example 1: bash replace substring
echo [string] | sed "s/[original]/[target]/g"
Example 2: bash replace beginning of string
$ cat shortest.sh
#! /bin/bash
filename="bash.string.txt"
echo ${filename#*.}
echo ${filename%.*}
$ ./shortest.sh
After deletion of shortest match from front: string.txt
After deletion of shortest match from back: bash.string