I would like to copy some files in a directory, renaming the files but conserving extension. Is this possible with a simple cp, using regex ?
cp
For example :
Suppose you have myfile.a, myfile.b, myfile.c:
myfile.a
myfile.b
myfile.c
for i in myfile.*; do echo mv "$i" "${i/myfile./newname.}"; done
This creates (upon removal of echo) newname.a, newname.b, newname.c.
echo
newname.a
newname.b
newname.c