Say I have three files (template_*.txt):
- template_x.txt
- template_y.txt
- template_z.txt
- foo_x.txt
- foo_y.txt
- foo_z.txt
for f in template_*.txt; do cp $f foo_${f#template_}; done
or
for file in template_*.txt ; do
cp $file `echo $file | sed 's/template_\(.*\)/foo_\1/'` ;
done