1

pure shell complex substitution in variable

view story
linux-howto

http://unix.stackexchange.com – However it may be impossible, I hope I'm just bad man reader =) Is there any way to substitute text in variables on several patterns at time or even using back reference? For example, I have FILE=filename.ext and I want to change it to filename_sometext.ext. But I don't know that file extension is .ext. All I know about it is that extension is after last dot. So I can do it in two steps: EXT=${FILE#*.} FILE=${FILE%.*}_sometext.$EXT Can I do it on one step (smth like ${FILE/.\(*\)/_sometext.\1} [that doesn't work])? By the way I need to do it in pure shell without sed/awk/etc. My shell is (HowTos)