var=test.txt; echo ${var/%[.][^.]*/}.p4`expr "$var" : '.*\([.][^.]*\)'` test.p4.txt