in reply to text substitution through single command line
Maybe the answers by GrandFather in string substitution will help you?